redisco icon indicating copy to clipboard operation
redisco copied to clipboard

mutex lock timeout

Open 72squared opened this issue 11 years ago • 0 comments

using the current machine time to specify the mutex lock timeout is probably a bad idea since the internal time might drift slightly from machine to machine (they should all be using NTP, but I'd rather not rely on that).

https://github.com/kiddouk/redisco/blob/master/redisco/models/base.py#L763

Rather than using an absolute time, why not just set the key with a value of 1 and pipeline in the expire timeout of 1 second. Let redis determine when the key will expire by using it relative to the server time.

http://redis.io/commands/setex

pipeline these commands: SET 1 SETEX 1

Then you only ever have to see if the lock exists, and don't care about the value.

72squared avatar Sep 11 '13 17:09 72squared