Closed grjones closed 6 years ago
@cameronmaske Any chance this could be merged in? Otherwise, we'll need to fork. Let me know!
@cameronmaske would be great to get this fix in to the codebase proper.
Sorry for the super delay on getting around to this. Looking at it today, will hopefully release shortly.
Thanks for the contribution @grjones, this should be live as version 2.0.0
Sure thing. Thanks @cameronmaske!
This PR addresses a race condition in the way the lock is obtained as explained in issue https://github.com/cameronmaske/celery-once/issues/7.
This implementation uses a safer SETNX-based lock from
redis-py
, which was already a requirement insetup.py
.The behavior after this change should remain the same with one exception. The
AlreadyQueued
exception no longer includescountdown
. This is becauseredis-py
uses a token for the value instead of a timestamp. The thought here is to not attempt to override anything thatredis-py
is doing since it is a known good implementation. If anyone feels strongly keepingcountdown
, it may be possible with some extra work.