Skip to content

Commit 3cd7dd8

Browse files
authored
Fixed code example in reduce spend docs page (#2350)
1 parent a782813 commit 3cd7dd8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

docs/how-to-reduce-your-spend.mdx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,10 @@ Sometimes it's more efficient to do more work in a single task than split across
104104
export const processItems = task({
105105
id: "process-items",
106106
run: async (payload: { items: string[] }) => {
107-
// Process all items in one run
108-
for (const item of payload.items) {
109-
// Do async work in parallel
110-
// This works very well for API calls
111-
await processItem(item);
112-
}
107+
// Process all items in parallel
108+
const promises = payload.items.map(item => processItem(item));
109+
// This works very well for API calls
110+
await Promise.all(promises);
113111
},
114112
});
115113
```

0 commit comments

Comments
 (0)