Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions src/content/docs/workflows/build/sleeping-and-retrying.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Use `step.sleep` to have a Workflow sleep for a relative period of time:
await step.sleep("sleep for a bit", "1 hour")
```

The second argument to `step.sleep` accepts both `number` (seconds) or a human-readable format, such as "1 minute" or "26 hours". The accepted units for `step.sleep` when used this way are as follows:
The second argument to `step.sleep` accepts both `number` (milliseconds) or a human-readable format, such as "1 minute" or "26 hours". The accepted units for `step.sleep` when used this way are as follows:

```ts
| "second"
Expand All @@ -48,7 +48,7 @@ const workflowsLaunchDate = Date.parse("24 Oct 2024 13:00:00 UTC");
await step.sleepUntil("sleep until X times out", workflowsLaunchDate)
```

You can also provide a Unix timestamp (seconds since the Unix epoch) directly to `sleepUntil`.
You can also provide a UNIX timestamp (milliseconds since the UNIX epoch) directly to `sleepUntil`.

## Retry steps

Expand All @@ -69,7 +69,7 @@ const defaultConfig: WorkflowStepConfig = {

When providing your own `StepConfig`, you can configure:

* The total number of attempts to make for a step
* The total number of attempts to make for a step (accepts `Infinity` for unlimited retries)
* The delay between attempts (accepts both `number` (ms) or a human-readable format)
* What backoff algorithm to apply between each attempt: any of `constant`, `linear`, or `exponential`
* When to timeout (in duration) before considering the step as failed (including during a retry attempt)
Expand Down
6 changes: 3 additions & 3 deletions src/content/docs/workflows/build/trigger-workflows.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ Calling `resume` on an instance that is not currently paused will have no effect

### Stop a Workflow

You can stop a Workflow instance by calling `abort` against a specific instance ID.
You can stop/terminate a Workflow instance by calling `terminate` against a specific instance ID.

```ts
let instance = await env.MY_WORKFLOW.get("abc-123")
await instance.abort() // Returns Promise<void>
await instance.terminate() // Returns Promise<void>
```

Once stopped, the Workflow instance *cannot* be resumed.
Once stopped/terminated, the Workflow instance *cannot* be resumed.

### Restart a Workflow

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 @@ -47,6 +47,8 @@ The `WorkflowEvent` type accepts an optional [type parameter](https://www.typesc

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

Finally, any JS control-flow primitive (if conditions, loops, try-catches, promises, etc) can be used to manage steps inside the `run` method.

## WorkflowEvent

```ts
Expand Down