joanvila / aioredlock

:lock: The asyncio implemetation of Redis distributed locks
MIT License
298 stars 51 forks source link

time.time -> time.monotonic #81

Closed kvirt closed 4 years ago

kvirt commented 4 years ago

Hello, i've noticed that you are using time.time() function to track timeouts for Lock/Unlock. According to docs it can return a lower value than a previous call and result in false positive timeout passing. For example when you change timezone or DST. i would suggest to use time.monotonic() which always returns non-decreasing values.

https://github.com/joanvila/aioredlock/pull/80