Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/content/changelogs/workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ productLink: "/workflows/"
productArea: Developer platform
productAreaLink: /workers/platform/changelog/platform/
entries:
- publish_date: "2024-12-19"
title: "Better instance control, improved queued logic & step limit increased"
description: |-
Workflows can now be terminated and pause instances from a queued state and the ID of an instance is now exposed via the `WorkflowEvent` parameter.

Also, the mechanism to queue instances was improved to force miss-behaved queued instances to be automatically errored.

Workflows now allow you to define up to 1024 steps in a single Workflow definition, up from the previous limit of 512. This limit will continue to increase during the course of the open beta.
- publish_date: "2024-12-09"
title: "New queue instances logic"
description: |-
Introduction of a new mechanism to queue instances, which will prevent instances from getting stuck on queued status forever.
- publish_date: "2024-11-30"
title: "Step limit increased"
description: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,16 @@ npx wrangler@latest workflows trigger workflows-starter '{"some":"data"}'

## TypeScript and type parameters

By default, the `WorkflowEvent` passed to the `run` method of your Workflow definition has a type that conforms to the following, with `payload` (your data) and `timestamp` properties:
By default, the `WorkflowEvent` passed to the `run` method of your Workflow definition has a type that conforms to the following, with `payload` (your data), `timestamp` and `instanceId` properties:

```ts
export type WorkflowEvent<T> = {
// The data passed as the parameter when the Workflow instance was triggered
payload: T;
// The timestamp that the Workflow was triggered
timestamp: Date;
// ID of the associated instance
instanceId: string;
};
```

Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/workflows/build/workers-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ Refer to the [events and parameters](/workflows/build/events-and-parameters/) do
export type WorkflowEvent<T> = {
payload: Readonly<T>;
timestamp: Date;
instanceId: string;
};
```

* The `WorkflowEvent` is the first argument to a Workflow's `run` method, and includes an optional `payload` parameter and a `timestamp` property.

* `payload` - a default type of `any` or type `T` if a type parameter is provided.
* `timestamp` - a `Date` object set to the time the Workflow instance was created (triggered).
* `instanceId` - the ID of the associated instance.

Refer to the [events and parameters](/workflows/build/events-and-parameters/) documentation for how to handle events within yur Workflow code.

Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/workflows/reference/limits.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ Many limits are inherited from those applied to Workers scripts and as documente
| Maximum persisted state per step | 1MiB (2^20 bytes) | 1MiB (2^20 bytes) |
| Maximum state that can be persisted per Workflow instance | 100MB | 1GB |
| Maximum `step.sleep` duration | 365 days (1 year) [^1] | 365 days (1 year) [^1] |
| Maximum steps per Workflow [^5] | 512 [^1] | 512 [^1] |
| Maximum steps per Workflow [^5] | 1024 [^1] | 1024 [^1] |
| Maximum Workflow executions | 100,000 per day [shared with Workers daily limit](/workers/platform/limits/#worker-limits) | Unlimited |
| Concurrent Workflow instances (executions) | 25 | 100 [^1] |
| Concurrent Workflow instances (executions) per account | 25 | 100 [^1] |
| Retention limit for completed Workflow state | 3 days | 30 days [^2] |
| Maximum length of a Workflow ID [^4] | 64 characters | 64 characters |

Expand Down
Loading