Let's talk

Topic

Concurrency & Retries

What happens when the same thing arrives twice, and which of the two wins.

12 articles

About this topic

Almost every article filed here starts the same way: something worked in testing and produced a duplicate in production. A payment provider sends two events for one payment. A queue redelivers. An operator reprocesses a batch. A client retries a request that had, in fact, succeeded. None of these are exotic, and a system that has not decided what it does about them has decided by accident.

The rule the collection keeps arriving at is that read-then-act is not a concurrency control, however careful the reading is. The condition has to be part of the write, and the caller that sees one affected row is the one allowed to continue. Everything else — uniqueness constraints, idempotency keys, replay-safe queues — is a backstop behind that.

Offline is a contract, not a feature

Designing field apps for staff with no signal: local-first writes, durable queues, idempotency and conflict rules decided by the business.

All articles