Wraps redis LuaLock or Lock object into RedisLockWrapper

Declined
#22 · Created  · Last updated

Declined pull request

`RedisLock` is compatible with the traditional "acquire()" signature

Closed by: ·2014-07-30

Description

Wraps redis lock, only exposing acquire and release.

Upper level functions should not call redis object directly. And catch RedisError while releasing a lock, because when trying to release a timeouted lock, redis will raise the following error.

Traceback (most recent call last): File "/Users/WooParadog/Codes/github/dogpile.cache/tests/cache/test_redis_backend.py", line 54, in test_catch_any_exceptions_when_releasing_mutex mutex.release() File "/Users/WooParadog/.virtualenvs/dogpile/lib/python2.7/site-packages/redis/lock.py", line 104, in release self.do_release() File "/Users/WooParadog/.virtualenvs/dogpile/lib/python2.7/site-packages/redis/lock.py", line 236, in do_release raise LockError("Cannot release a lock that's no longer owned") LockError: Cannot release a lock that's no longer owned

0 attachments

0 comments

Loading commits...