Skip to content
Merged
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/rules-of-workflows.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,15 @@ export class MyWorkflow extends WorkflowEntrypoint {

### Name steps deterministically

Steps should be named deterministically (even if dynamic). This ensures that their state is cached, and prevents the step from being rerun unnecessarily. Step names act as the "cache key" in your Workflow.
Steps should be named deterministically (ie, not using the current date/time, randomness, etc). This ensures that their state is cached, and prevents the step from being rerun unnecessarily. Step names act as the "cache key" in your Workflow.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Steps should be named deterministically (ie, not using the current date/time, randomness, etc). This ensures that their state is cached, and prevents the step from being rerun unnecessarily. Step names act as the "cache key" in your Workflow.
Steps should be named deterministically (that is, not using the current date/time, randomness, etc). This ensures that their state is cached, and prevents the step from being rerun unnecessarily. Step names act as the "cache key" in your Workflow.

Issues:

  • Style Guide - (cloudflare.LatinTerms-warning) Use 'that is' instead of 'ie,', but consider rewriting the sentence.

Fix Explanation:

The suggestion to replace 'ie,' with 'that is,' is valid as it enhances clarity. The abbreviation 'ie,' is less formal and can be misinterpreted. The revised sentence maintains the original meaning while improving readability. No other issues were identified in the sentence.



```ts
export class MyWorkflow extends WorkflowEntrypoint {
async run(event: WorkflowEvent<Params>, step: WorkflowStep) {
// 🔴 Bad: Dynamically naming the step prevents it from being cached
// 🔴 Bad: Naming the step non-deterministically prevents it from being cached
// This will cause the step to be re-run if subsequent steps fail.
await step.do(`step #1 running at: ${Date.now}`, async () => {
await step.do(`step #1 running at: ${Date.now()}`, async () => {
let userData = await env.KV.get(event.user)
event.data = userData
})
Expand Down
Loading