cameronmaske / celery-once

Celery Once allows you to prevent multiple execution and queuing of celery tasks.
https://pypi.python.org/pypi/celery_once/
BSD 2-Clause "Simplified" License
662 stars 90 forks source link

Allow not setting any timeout on the lock #15

Closed brouberol closed 5 years ago

brouberol commented 9 years ago

This is more a feature request/suggestion than a bug.

I sugest adding the possibility of setting timeout = None on the task (and also on the ONCE_DEFAULT_TIMEOUT configuration key). When doing so, no TTL would be set on the lock keys. Only the completion (or the failure) of the task itself would remove the lock, in the Task.after_return method.

I think this could be useful in the case of regular tasks with a highly variable time of execution, given the amount of work they have to perform. In this case, we just want to make sure the task is not executed concurrently multiple times, intead of having to guess an appropriate timeout.

It also should not break any pre-existing behaviour. What do you think?

cameronmaske commented 9 years ago

@brouberol This makes sense to support and shouldn't be to difficult.

brouberol commented 9 years ago

Cool. I'll create a pull request for this during the day.

danechitoaie commented 9 years ago

I'm also interested in this. Is this available yet?

VidJa commented 8 years ago

Would be valueable for me too