You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Flush buffered events before emitting time-skipping transition
A time-skipping transition must be the last event of the transaction that
produces it: it is a server-generated state change applied synchronously
(it bumps AccumulatedSkippedDuration and drives timer-task regeneration in
the same close-transaction), so it must order after every other event.
WORKFLOW_EXECUTION_OPTIONS_UPDATED is a buffered event type while the
transition is not. When an options update re-enables (or enables) time
skipping on an idle workflow with a pending timer, the close-transaction
emits a transition in the same transaction as the buffered OPTIONS_UPDATED.
The non-buffered transition was allocated an event ID immediately, before
the buffered OPTIONS_UPDATED was flushed in closeTransactionPrepareEvents,
inverting their order and producing non-monotonic event timestamps.
Flush pending buffered events in closeTransactionHandleWorkflowTimeSkipping
before emitting the transition. Safe here: isWorkflowSkippable already
guarantees no in-flight workflow task, which is FlushBufferedEvents' own
precondition. The transition stays non-buffered, so reorderBuffer never
moves it and it remains the last-allocated event.
Add TestTransitionEventIsLastInTransaction to TimeSkippingTestSuite guarding
the invariant.
0 commit comments