Closed bepetersn closed 7 years ago
Maybe I misunderstood the purpose of celery-once. Is there a builtin way to not clear the lock until it expires? I don't want to clear it before it runs either. Rather, I want to wait for my lock to timeout, to ensure the same task doesn't get run again, even if the first one finishes before the second attempt starts.
I achieved this by subclassing the QueueOnce
Task base & overriding the the on_return
method to a no-op. This way, the lock never gets cleared. I set a timeout of just 5 minutes. Works like a charm!
My setup is intricate, so this may not be the fault of celery-once... Working on an example repo to reproduce, but if anyone has seen this before, would love to know.
Specifically, what I'm doing is monitoring the redis server while running my tasks, and I see something like
GET, SETEX, DEL
, on the celery-once key, all in quick succession.