Skip to content

Comment on A proposal for more reliable locks using Redis

Comments

I wrote a very similar, Redis-based lock in Python a while ago, here it is:

https://gist.github.com/adewes/6103220

It uses Redis pipelines and watchers to make sure that no race conditions between two processes requiring the same lock occur, and uses "expire" keys to avoid deadlocks.

I prefer Lua-scripting based approach: https://github.com/bbangert/retools/blob/master/retools/lock..., but I had to implement something similar to your code to support older Redis versions.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.