From 0f4c39ede0e12ad2415a035c65adca3ea116c8e3 Mon Sep 17 00:00:00 2001 From: Nevo David Date: Tue, 6 Jan 2026 21:13:51 +0700 Subject: [PATCH] feat: never exit workflow --- apps/orchestrator/src/workflows/send.email.workflow.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/apps/orchestrator/src/workflows/send.email.workflow.ts b/apps/orchestrator/src/workflows/send.email.workflow.ts index 7b9f3d43..ac4d9342 100644 --- a/apps/orchestrator/src/workflows/send.email.workflow.ts +++ b/apps/orchestrator/src/workflows/send.email.workflow.ts @@ -35,10 +35,7 @@ export async function sendEmailWorkflow({ // Process emails with rate limiting while (true) { // Wait until there's an email in the queue or timeout after 1 hour of inactivity - const waitForQueue = await condition(() => queue.length > 0, '1 hour'); - if (!waitForQueue) { - return; - } + await condition(() => queue.length > 0); try { const email = queue.shift()!; @@ -53,7 +50,7 @@ export async function sendEmailWorkflow({ await sleep(RATE_LIMIT_MS); - if (processedThisRun >= 100) { + if (processedThisRun >= 30) { return await continueAsNew({ queue }); } }