Fixed code example in reduce spend docs page (#2350)

This commit is contained in:
James Ritchie
2025-08-06 17:18:59 +01:00
committed by GitHub
parent a782813c6c
commit 3cd7dd86d4
+4 -6
View File
@@ -104,12 +104,10 @@ Sometimes it's more efficient to do more work in a single task than split across
export const processItems = task({
id: "process-items",
run: async (payload: { items: string[] }) => {
// Process all items in one run
for (const item of payload.items) {
// Do async work in parallel
// This works very well for API calls
await processItem(item);
}
// Process all items in parallel
const promises = payload.items.map(item => processItem(item));
// This works very well for API calls
await Promise.all(promises);
},
});
```