Repository navigation
docs(workflow): add singleton workflows how-to - #900
Merged
Merged
Conversation
Document running at most one workflow run at a time by reusing the same workflowRunId (requires @upstash/workflow 1.4.0): - keep the running one: a trigger while a run is in progress is rejected - replace the running one: client.cancel, then client.trigger Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Contributor
|
Docs7 for upstash.com
Commit |
context7
Bot
temporarily deployed
to
Docs7 Preview: docs/workflow-singleton
October 7, 2026 10:53
Destroyed
Copilot stopped reviewing on behalf of
CahidArda due to an error
October 7, 2026 11:56
Contributor
There was a problem hiding this comment.
Note
Copilot was unable to run its full agentic suite in this review.
Copilot review overview
Review effort: Lite
Findings: 2
Open (3)
What changed in this PR
Adds documentation for “singleton workflows” to help users ensure only one workflow run is active at a time by reusing a fixed workflowRunId.
Changes:
- Added a new how-to page describing singleton workflow patterns (reject new trigger vs cancel-and-replace).
- Updated docs indexes/exports to include the new page (search listing, full LLM dump, docs navigation JSON).
| File | Description |
|---|---|
| workflow/howto/singleton.mdx | New documentation page explaining singleton workflow behavior and usage patterns. |
| llms.txt | Adds the new page to the docs search/listing index. |
| llms-full.txt | Adds the full content of the new singleton workflows page to the consolidated docs dump. |
| docs.json | Adds the new page to the workflow/howto navigation structure. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+49
to
+55
| } catch (error) { | ||
| if (error instanceof Error && error.message.includes("a workflow already exists")) { | ||
| console.log("nightly-sync is already running, skipping"); | ||
| } else { | ||
| throw error; | ||
| } | ||
| } |
Contributor
Author
There was a problem hiding this comment.
We have to rely on the text message as 400 can be mixed with other cases.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
context7
Bot
temporarily deployed
to
Docs7 Preview: docs/workflow-singleton
October 7, 2026 12:06
Destroyed
…message Match QstashError with status 400 instead of the error text, and confirm a run with the id is in progress with client.logs, since 400 also covers other invalid trigger requests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
context7
Bot
temporarily deployed
to
Docs7 Preview: docs/workflow-singleton
October 7, 2026 12:13
Destroyed
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
context7
Bot
temporarily deployed
to
Docs7 Preview: docs/workflow-singleton
October 7, 2026 13:50
Destroyed
CahidArda
approved these changes
Oct 7, 2026
This branch was successfully deployed
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.


Adds
workflow/howto/singleton.mdx, a how-to for running at most one workflow run at a time by reusing the sameworkflowRunId. It's listed in the nav after "Cancel a Run".Covers two patterns, and what the caller gets back in each case:
QstashError(400,a workflow already exists, can not initialize a new one with same id). Otherwise the trigger returns{ workflowRunId }.client.cancel(id)returns{ cancelled: 1 | 0 }, thenclient.triggerstarts the new run.Requires
@upstash/workflow1.4.0 (upstash/workflow-js#214) and upstash/qstash-server#1129. The page notes workflow-py isn't supported yet.Roadmap: https://github.com/orgs/upstash/discussions/192