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.
An LLM gateway is failure handling on one request path: routing, retries, a circuit breaker, streaming fallbacks and per-tenant budgets, with a FastAPI gateway you can run and the numbers its tests measured.
Six rate limiting algorithms run through the same 100-a-minute limit and the same traffic, with what each let through, what it costs in Redis, and atomic Lua code for Python.
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.
Turn messy datasets into clear, compelling charts with Python’s three most powerful libraries.
Ditch print() for good — IceCream makes Python debugging faster and far less painful.
Slow loops are killing your code; here are the faster, cleaner ways to transform data.
Thirty-five practical tricks to make your Python cleaner, faster, and a pleasure to read.