From 199e7bc213de1f4900e9279c1d2a9640b74e0505 Mon Sep 17 00:00:00 2001 From: James Ritchie Date: Wed, 6 Aug 2025 08:52:54 +0100 Subject: [PATCH] Fixed code example in reduce spend docs page --- docs/how-to-reduce-your-spend.mdx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/how-to-reduce-your-spend.mdx b/docs/how-to-reduce-your-spend.mdx index 53bac28049..a65af5ce47 100644 --- a/docs/how-to-reduce-your-spend.mdx +++ b/docs/how-to-reduce-your-spend.mdx @@ -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); }, }); ```