OB_access: The Email Queue That Refuses to Forget
A self-hosted campaign engine that precomputes every send, guards every claim, and rebuilds its own queue when the system drifts.
- OB_access treats email delivery as a recoverable timeline, with Postgres as the durable source of truth and Redis as a disposable execution layer.
- Its unusual strength is that every recipient is materialized up front, so the campaign’s future is visible before any worker runs.
- The worker path is disciplined: claim only scheduled rows, enforce limits atomically, and slide work forward instead of losing it.
- Reconciliation is not a cleanup task here, it is the recovery mechanism that makes the queue self-healing.
Most mailers optimize for throughput. OB_access optimizes for truth. It turns a campaign into a schedule that can be inspected, retried, and rebuilt, which is a very different promise from “send jobs into a queue and hope.”
The queue that rebuilds itself
The core idea is simple: the database owns the campaign state, not Redis. That means a Redis reset is annoying, but not fatal. If the queue drifts, the system can reconstruct it from Postgres and continue from the last known truth.
That design changes the emotional contract of the app. Instead of hiding delivery behind workers, it exposes the future as rows, timestamps, and states. The result feels less like a mailer and more like a delivery ledger with a repair loop.
Every email gets a time before it gets a job
The standout scheduling move lives in packSchedule. Rather than letting workers decide timing on the fly, the scheduler fans a campaign out into individual Email rows, assigns each one a scheduledAt, and writes them in a transaction.
That is a deliberate tradeoff. Precomputing the schedule gives users a clear campaign timeline, but it also means runtime checks still matter. The system chooses visibility first, then protects that visibility with recovery logic when conditions change.
// Conceptual shape of the scheduler
for (const recipient of recipients) {
const scheduledAt = new Date(startAt.getTime() + offsetMs);
await prisma.email.create({
data: {
campaignId,
recipient,
scheduledAt,
status: 'SCHEDULED'
}
});
}
The claim-check-send pattern
The worker is disciplined about state transitions. A job is only claimed if the row is still SCHEDULED, which means competing workers can race but only one can win. That keeps duplicates from turning into chaos.
If a worker stalls or crashes, the system does not leave the row stranded forever. Stalled handling and recovery logic release the claim and let the campaign move forward again, which is exactly what you want from a delivery engine that expects failure.
Redis as an atomic gatekeeper
The rate limiter matters because it is atomic. The Redis Lua script checks and increments both global and per-sender counters in one operation, so workers cannot race each other into breaking the hourly ceiling.
When the limit is hit, the job does not fail. It slides into the next hour window. That is a practical compromise, and it fits the whole design philosophy of the project: preserve the campaign, preserve the order, preserve the intent.
| Concern | Conventional queue mailer | OB_access |
|---|---|---|
| Scheduling model | Computed at runtime by workers | Precomputed per recipient in the database |
| Source of truth | Queue state | Postgres rows and states |
| Duplicate prevention | Best effort dedupe | Deterministic job IDs plus claim checks |
| Rate limiting | Often split across worker logic | Single atomic Redis Lua gate |
| Crash recovery | Requeue and hope | Reconcile Redis from Postgres |
| User visibility | Hidden behind jobs | Visible campaign timeline |
Here the architecture makes its bet obvious. It prefers explicit state over hidden worker behavior, and it prefers a slightly delayed send over a broken one.
Reconciliation is the real superpower
The reconciler is what turns the system from robust into self-healing. On boot, it compares the database against Redis, finds scheduled emails that are missing jobs, and restores the queue from first principles.
That is the project’s real reliability trick. Redis is treated as an execution cache, not as the memory of the system. If Redis disappears, the campaign does not forget itself.
- Redis can vanish without erasing intent.
- Deterministic IDs make re-enqueueing safe.
- Scheduled rows in Postgres can repopulate the queue.
- The campaign resumes from state, not superstition.
Why this feels different from a normal mailer
Most email tools sell templates, analytics, and delivery volume. OB_access is more interested in temporal determinism, self-repair, and queue truth. That makes it feel closer to a durable task system than a marketing app.
| Question | Normal mailer | OB_access |
|---|---|---|
| What is the future of the campaign? | Implicit inside jobs | Explicit in scheduled rows |
| What happens on failure? | Retries and operational cleanup | Reconciliation reconstructs missing work |
| What does the user see? | A black box until send time | A visible campaign timeline |
| What does the system trust? | The queue and worker lifecycle | The database first, queue second |
That is why the project stands out. It does not merely send email. It makes delivery legible, then makes legibility durable.