Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(workflows): retry ses-throttled emails instead of dropping them (#112295)

Michael Reichenbachecc6b4f7086a
diff --git a/nodejs/src/cdp/services/messaging/email.service.test.ts b/nodejs/src/cdp/services/messaging/email.service.test.ts
index a50885b752b7..adf73135e11a 100644
--- a/nodejs/src/cdp/services/messaging/email.service.test.ts
+++ b/nodejs/src/cdp/services/messaging/email.service.test.ts
@@ -420,6 +420,7 @@ describe('EmailService', () => {
// than the upper bound + scheduler overhead.
expect(scheduledMs).toBeGreaterThanOrEqual(before + 400)
expect(scheduledMs).toBeLessThan(before + 2000)
+ expect(result.invocation.queueParameters).toEqual(invocation.queueParameters)
// No business metric emitted on throttle — the eventual retry
// will produce email_sent.
expect(result.metrics ?? []).toEqual([])
diff --git a/nodejs/src/cdp/services/messaging/email.service.ts b/nodejs/src/cdp/services/messaging/email.service.ts
index 8c906c3f8657..f1c3571e49f6 100644
--- a/nodejs/src/cdp/services/messaging/email.service.ts
+++ b/nodejs/src/cdp/services/messaging/email.service.ts
@@ -627,6 +627,7 @@ export class EmailService {
// catches the cases where SES disagrees with our estimate.
throttled = true
result.finished = false
+ result.invocation.queueParameters = params
result.invocation.queueScheduledAt = DateTime.utc().plus({ milliseconds: error.retryAfterMs })
addLog('warn', `SES rate-limited (${error.errorCode}); rescheduling email in ${error.retryAfterMs}ms`)
} else {