From 95eace849b72ac27bb8de38a0d9d84524a6d0c4c Mon Sep 17 00:00:00 2001 From: Nevo David Date: Tue, 6 Jan 2026 17:02:50 +0700 Subject: [PATCH] fix: send email --- .../src/workflows/send.email.workflow.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/orchestrator/src/workflows/send.email.workflow.ts b/apps/orchestrator/src/workflows/send.email.workflow.ts index 932e5092..7b8255e1 100644 --- a/apps/orchestrator/src/workflows/send.email.workflow.ts +++ b/apps/orchestrator/src/workflows/send.email.workflow.ts @@ -14,11 +14,7 @@ import { const { sendEmail } = proxyActivities({ startToCloseTimeout: '10 minute', taskQueue: 'main', - retry: { - maximumAttempts: 3, - backoffCoefficient: 1, - initialInterval: '2 minutes', - }, + cancellationType: 'ABANDON', }); const RATE_LIMIT_MS = 700; @@ -30,8 +26,10 @@ export async function sendEmailWorkflow({ }) { let processedThisRun = 0; // Handle incoming email signals - setHandler(sendEmailSignal, (email: SendEmail) => { - queue.push(email); + setHandler(sendEmailSignal, (addEmail: SendEmail) => { + if (addEmail.to && addEmail.subject) { + queue.push(addEmail); + } }); // Process emails with rate limiting @@ -39,12 +37,14 @@ export async function sendEmailWorkflow({ // 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) { - break; + return; } try { const email = queue.shift()!; - + if (!email) { + continue; + } await sendEmail(email.to, email.subject, email.html, email.replyTo); processedThisRun++; } catch (err) {}