Implement Timeout for MemcacheLock

Issue #54 resolved
Anonymous created an issue

Similar to the REDIS backend, the Memcache backend supports distributed locking. It looks like there is no lock_timeout configurable for the distributed lock in Memcached:

Compared to redis:

This means that in some cases you could achieve a state with bad locking that could cause a (near) endless loop.

Comments (8)

  1. Michael Bayer repo owner

    it's easy for us to support timeout for the redis lock because we are using the lock implementation that comes with the Python redis client. If such a lock exists for memcached, that might be preferable (e.g. if there's something on pypi which is widely used and super-well-written, I'd consider it). otherwise, if submitting a pull req please try to make sure the timeout parameter is tested and does what it advertises.

  2. Morgan Fainberg

    I have some tentative code that I'm using in a wrapper for dogpile. I'll see if I can distill it. Of course, testing in this case is super important. I will 2x check to see if we have some "lock" mechanism that makes sense to use on pypi before trying to use the more-domain specific code I've developed.

  3. Log in to comment