Databases
Bug Report
Redis distributed lock expired mid-job: two workers held it, fencing tokens fixed it
Our monthly statement job used a Redis SET NX lock with a 30 second TTL. One slow run outlived the TTL, a second worker took the lock, and 214 customers got duplicated statement lines. Here is why a TTL lock alone cannot be safe and how fencing tokens closed the gap.