celery-singleton icon indicating copy to clipboard operation
celery-singleton copied to clipboard

Inconsistency with countdown

Open laxusgooee opened this issue 1 year ago • 0 comments

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)

laxusgooee avatar May 06 '23 20:05 laxusgooee