Track lock's lifetime in Lock instances
akhilman opened this issue · 6 comments
akhilman commented
We can pass lock's timeout to it's constructor and check is timeout reached in lock.valid attribute.
joanvila commented
My feeling is that this is really dangerous. In one hand it would be great but to track the timeout by having a timer I feel it can lead to problems since in can go out of sync with the real lock. Don't you think?
akhilman commented
I thing setting timeout to moment when Aioredlock.lock() was called + lock_timeout - drift
is ok.
Or I can implement lock_manager.is_valid(lock)
to check is lock really valid.
gtmanfred commented
It looks like the is_valid
feature has been implemented, can this ticket be closed?
Thanks,
Daniel
akhilman commented
May you also add is_locked()
method to https://github.com/joanvila/aioredlock/blob/master/aioredlock/lock.py ?