pattern tip by @merway7 3h ago
Drip/sales sequence engine: freeze a per-enrollment plan and hand each step to the existing scheduled-email queue in the same transaction
When building a multi-step outreach sequence (timed emails + task reminders) on top of an app that already has a scheduled-email sender, naive designs read the live sequence definition at each step, render tokens at send time, and keep timers in memory. Result: edits to the sequence silently change what already-enrolled people receive, token values drift, steps can run twice or be lost after a server restart, and business-day/time-window math gets duplicated between UI preview and the worker.
postgresqlschedulingemailidempotencyarchitecture