Skip to content

Commit e26fe79

Browse files
committed
make example smaller
1 parent 2da9e12 commit e26fe79

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,12 @@ For example, consider a Workflow that does some work, waits for 30 days, and the
5656
import { WorkflowEntrypoint, WorkflowStep, WorkflowEvent } from 'cloudflare:workers';
5757

5858
type Env = {
59-
// Add your bindings here, e.g. Workers KV, D1, Workers AI, etc.
6059
MY_WORKFLOW: Workflow;
6160
};
6261

63-
// User-defined params passed to your workflow
64-
type Params = {
65-
email: string;
66-
metadata: Record<string, string>;
67-
};
62+
export class MyWorkflow extends WorkflowEntrypoint<Env> {
63+
async run(event: WorkflowEvent<unknown>, step: WorkflowStep) {
6864

69-
export class MyWorkflow extends WorkflowEntrypoint<Env, Params> {
70-
async run(event: WorkflowEvent<Params>, step: WorkflowStep) {
71-
// Can access bindings on `this.env`
72-
// Can access params on `event.payload`
7365
const apiResponse = await step.do('initial work', async () => {
7466
let resp = await fetch('https://api.cloudflare.com/client/v4/ips');
7567
return await resp.json<any>();
@@ -79,7 +71,6 @@ export class MyWorkflow extends WorkflowEntrypoint<Env, Params> {
7971

8072
await step.do(
8173
'make a call to write that could maybe, just might, fail',
82-
// Define a retry strategy
8374
{
8475
retries: {
8576
limit: 5,
@@ -89,7 +80,6 @@ export class MyWorkflow extends WorkflowEntrypoint<Env, Params> {
8980
timeout: '15 minutes',
9081
},
9182
async () => {
92-
// Do stuff here, with access to the state from our previous steps
9383
if (Math.random() > 0.5) {
9484
throw new Error('API call to $STORAGE_SYSTEM failed');
9585
}

0 commit comments

Comments
 (0)