Skip to content

Commit 13185bd

Browse files
authored
[Workflows] Add create/createBatch clarification regarding instances with repeated IDs (#26457)
1 parent 1658132 commit 13185bd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/content/docs/workflows/build/workers-api.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ return Response.json({
266266

267267
Returns a `WorkflowInstance`.
268268

269+
Throws an error if the provided ID is already used by an existing instance that has not yet passed its [retention limit](/workflows/reference/limits/). To re-run a workflow with the same ID, you can [`restart`](/workflows/build/trigger-workflows/#restart-a-workflow) the existing instance.
270+
269271
<Render file="workflows-type-parameters" product="workflows" />
270272

271273
To provide an optional type parameter to the `Workflow`, pass a type argument with your type when defining your Workflow bindings:
@@ -326,6 +328,8 @@ let instances = await env.MY_WORKFLOW.createBatch(listOfInstances);
326328

327329
Returns an array of `WorkflowInstance`.
328330

331+
Unlike [`create`](/workflows/build/workers-api/#create), this operation is idempotent and will not fail if an ID is already in use. If an existing instance with the same ID is still within its [retention limit](/workflows/reference/limits/), it will be skipped and excluded from the returned array.
332+
329333
### get
330334

331335
Get a specific Workflow instance by ID.

src/content/docs/workflows/reference/limits.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ Many limits are inherited from those applied to Workers scripts and as documente
2727
| Concurrent Workflow instances (executions) per account [^7] | 25 | 10,000 |
2828
| Maximum Workflow instance creation rate [^8] | 100 per second [^6] | 100 per second [^6] |
2929
| Maximum number of [queued instances](/workflows/observability/metrics-analytics/#event-types) | 10,000 | 100,000 |
30-
| Retention limit for completed Workflow state | 3 days | 30 days [^2] |
30+
| Retention limit for completed Workflow instance state | 3 days | 30 days [^2] |
3131
| Maximum length of a Workflow name [^4] | 64 characters | 64 characters |
3232
| Maximum length of a Workflow instance ID [^4] | 100 characters | 100 characters |
3333
| Maximum number of subrequests per Workflow instance | 50/request | 1000/request |
3434

35-
[^2]: Workflow state and logs will be retained for 3 days on the Workers Free plan and for 7 days on the Workers Paid plan.
35+
[^2]: Workflow instance state and logs will be retained for 3 days on the Workers Free plan and for 30 days on the Workers Paid plan.
3636

3737
[^3]: A Workflow instance can run forever, as long as each step does not take more than the CPU time limit and the maximum number of steps per Workflow is not reached.
3838

0 commit comments

Comments
 (0)