Hey, I'm implementing some workflow ```typescript await step.do("process-events", async () => { c

Hey, I'm implementing some workflow

await step.do("process-events", async () => {
  const eventsGroupedBySomething = [[], [], [], [], [], []]; // potentially ~10 groups with 100s of events each

  for (const events of eventsGroupedBySomething) {
    for (let i = 0; i < events.length; i++) {
      const event = events[i]!;
      const { embedding, summary } = await generateEventSummary(event);
      await db
        .insert(schema.eventVector)
        .values({ id: nanoid(), eventId: event.id, embedding, summary });
    }
  }
});


and I'd want to wrap the inner loop in a step.do for retries but then I could really quickly hit 1024 steps limit. Maybe I could invoke separate workflow in the inner loop to just handle processing the event? But then my generateEventSummary might throw 429 error. I guess sending queue message for every event and handling it in separate worker might be a better approach? What would be the "idiomatic" CF approach? Thanks!
Was this page helpful?