joanvila/aioredlock

Track lock's lifetime in Lock instances

akhilman opened this issue · 6 comments

We can pass lock's timeout to it's constructor and check is timeout reached in lock.valid attribute.

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?

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.

May be fixed in testing branch.

With #54 Aioredlock now can automatically extend lock lifetime.

It looks like the is_valid feature has been implemented, can this ticket be closed?

Thanks,
Daniel