Reliability engineering for Rails and AI backends.

Deep dives on the systems that have to stay correct when things go wrong: background jobs, Postgres, and AI backends. Each one is grounded in open-source code I build and ship.

Why Your Sidekiq Job Runs Twice (At-Least-Once Delivery Explained)

Sidekiq runs jobs at least once, so duplicates happen. The 5 windows where a job re-runs — and how to stop double-charges with idempotent workers.

Danial AsgharBackground Jobs & Async15 min read

At-least-once delivery · the retry loop

Job enqueuedWorker picks up jobperform runscharges the card · the side effectRun confirmedcomplete?yesRAN ONCEDonecrash · deploy timeout · Redis blipJob returned to the queuenever confirmed — not “it didn’t happen”runs again — at least once
Figure 1. The loop closes on “the system couldn’t confirm the work,” not “the work didn’t happen.” Only a confirmed run is done; anything else returns to the queue and runs again.

All 9 articles

About the author

Danial Asghar
Senior Backend Engineer

I build and fix production Rails systems: background jobs, Postgres and AI-backed workflows. More about me

Selected work

All projects →

Open-source systems and experiments behind the ideas I write about.