celery-singleton
celery-singleton copied to clipboard
Inconsistency with countdown
I have a task:
@shared_task(bind=True, base=Singleton, lock_expiry=10, raise_on_duplicate=True)
def encode_posts(self):
# do some things, which might take longer than 15s, in which case call encode_posts.apply_async() else:
encode_posts.apply_async(countdown=15)
the problem is, sometimes the code runs as I want it, i.e. runs every 15s. Other times it raises the duplicate exception.
What I want is to release the lock before calling encode_posts.apply_async(countdown=15)