Repository navigation
Ignore stale workflow handler runs and failure notifications - #330
Merged
Merged
Conversation
N parallel steps queue N handler runs of one generation. After the workflow failed, the extra runs replayed the handler, threw "Workflow not running" from complete, and were recorded as Workpool failures, each followed by a failing handlerOnComplete (#327, #328). - workflowMutation returns for any finished run, and checks generation and terminal state before failing on an oversized journal. - handlerOnComplete returns when its workflow is gone, at another generation, or already finished. - completeHandler's error names the workflow id.
commit: |
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
* Skip reading the journal of a finished workflow journal.load with shortCircuit returns no entries when the workflow has a result. workflowMutation returns before using the journal in that case, so duplicate handler runs no longer read up to the journal size limit. * Test the journal short circuit with a journal over the size limit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #327, #328.
Each completing step enqueues a handler run, so N parallel steps queue N runs of one generation. Once the workflow has failed, the remaining runs replay the handler, throw
Workflow not runningfromcomplete, and are recorded as Workpool failures. Each of those then triggers ahandlerOnCompletethat throws the same error.Changes
workflowMutationreturns early for any finished run, not only a successful one.workflowMutationchecks the generation and terminal state before the oversized-journal branch, so a stale run no longer callscomplete.handlerOnCompletelogs and returns when its workflow is absent, at another generation, or already finished. A live workflow is still failed as before; a malformed id still goes throughcompleteHandler.completeHandler's error interpolates the workflow id instead of[object Object].Step completion still enqueues the handler unconditionally. The duplicate runs are still queued; they now return without replaying.
Measured
30 parallel steps followed by a throwing handler, in convex-test:
Workflow not runningerrorsTests
example/convex/test/fanIn.test.ts: fan-in that fails or succeeds replays once and reports no handler failures; a duplicate run of a finished workflow does not replay.src/component/workflow.test.ts:handlerOnCompleteagainst live, finished, restarted, canceled and cleaned-up workflows; a stale-generation run with a journal over the size limit.example/convex/_generated/api.d.tswas edited by hand to add the new test module.