You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Broadcast today does for sub := range subscribers inside a goroutine launched on the request thread. For 50k+ subscriber lists this means:
The goroutine holds resources for minutes
A backend restart in the middle drops the rest of the broadcast on the floor
No retry on transient SMTP failures
No visibility while it runs ('is it 30% done?' is unanswerable)
One slow recipient (DNS timeout, rate-limited host) blocks the next
Proposal
Replace the inline loop with a job queue. On broadcast, enqueue one job per recipient. Workers pull jobs, send, write results. State persists across restarts; visibility is a count of pending vs done.
Backend choice: stay simple. Use asynq (Redis-backed) — already a dep candidate since we use Redis for cache and rate limits. Or roll a lightweight Postgres-backed queue with SELECT FOR UPDATE SKIP LOCKED if we want to avoid Redis as a hard dep.
The previous MarkInProgressBroadcastsInterrupted flagged every 'sending' broadcast as 'interrupted' at startup. But jobs were also reset to 'retry' by ResetStuckSendingJobs, so workers in fact resumed sending. Side effects:
UI showed "this broadcast was interrupted, the remaining did not receive the email" while emails were still going out
Pro Analytics lost visibility (broadcasts_in_flight filters status='sending')
Polling stopped early on the broadcasts list page
ReconcileStuckBroadcasts now only marks 'completed' the broadcasts whose jobs have all settled, leaving the rest as 'sending' so the worker pool keeps processing. Also reconciles any legacy 'interrupted' rows.
Follow-ups (separate issues)
Throughput benchmark (the ~50 emails/sec claim is unverified)
Per-broadcast cancel action (no cancelled status today)
Activity
feat(logs): search + expandable detail row, broadcast persistence
feat(broadcasts): per-recipient queue with exponential backoff retries
docs: v0.6.4 changelog, queue/in-flight guide, swarm troubleshooting
JuansesDev commentedon May 28, 2026
Delivered
Worker queue infrastructure was already in place; this issue is now fully complete after fixing the last inconsistency around restart recovery.
Acceptance criteria
broadcast_worker.go(ResetStuckSendingJobson startup) +ReconcileStuckBroadcasts(62f93de)broadcast_worker.go:158-185BroadcastsSection.vuepollsGET /projects/:id/broadcastsevery 3s while any broadcast issendingsenddock-pro/internal/analytics/analytics.go:355-380(broadcasts_in_flightfield, filtersstatus='sending') +AnalyticsSection.vue:535-549Architecture summary
broadcast_jobstable withFOR UPDATE SKIP LOCKEDclaim patternSent/Suppressed/Bounced/TransientErrorfor correct counter updates and retry decisionsfor sub := range subscriberswas replaced with a single bulk insert intobroadcast_jobs; the request returns immediately with the broadcast IDRestart-recovery fix (62f93de)
The previous
MarkInProgressBroadcastsInterruptedflagged every'sending'broadcast as'interrupted'at startup. But jobs were also reset to'retry'byResetStuckSendingJobs, so workers in fact resumed sending. Side effects:broadcasts_in_flightfiltersstatus='sending')ReconcileStuckBroadcastsnow only marks'completed'the broadcasts whose jobs have all settled, leaving the rest as'sending'so the worker pool keeps processing. Also reconciles any legacy'interrupted'rows.Follow-ups (separate issues)
cancelledstatus today)fix(broadcasts): reconcile in-flight broadcasts on restart instead of…