Redis Distributed Locks in Python: SET NX, Redlock, Fencing Tokens
A Redis lock is a timed lease: this post breaks one with a stall, then makes Postgres reject the stale writer with a fencing token, with measured lost updates.
A Redis lock is a timed lease: this post breaks one with a stall, then makes Postgres reject the stale writer with a fencing token, with measured lost updates.
Kafka’s exactly-once stops at Kafka’s edge, so here’s a Python idempotent consumer with an inbox table, hard-killed 100 times mid-stream to count duplicates and losses.
Your order saved, but the event never reached Kafka. Build the transactional outbox pattern in Python and Postgres: a SKIP LOCKED relay that’s safe on several workers, fixes for ordering and cleanup, and lessons from seven teams that hit the dual write.
A timeout can’t tell you whether the card was charged, so an idempotency key lets the retry get the original result back instead of charging twice.