You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to run a cron every 5 seconds, when job_id is set? (does the minimum have to be 60 seconds?) #459
I need to run a cron in my worker every 5 seconds, but I also want to provide it a job_id so there's no duplicates running in parallel. The next cron task for the job should only run if the previous one is completed.
My cron definition:
cron(
my_task,
unique=True,
job_id="cron_my_task", # to prevent duplicate task runs
second=set(range(0, 60, 5)), # every 5 seconds
keep_result=0,
max_tries=1,
),
But when I configure a worker with this, I notice there's an in-progress entry created with a TTL of 60 seconds, which prevents any future cron runs from running till it expires, even if my tasks is completed in a few seconds.
Am I missing something important here? As this behavior feels rather unpredictable, and undocumented.
Apparently, there is another symptom to that. Even if one schedules a run every minute, effectively the in-progress key expires 1 minute after the job finishes. So, the key would actually expire after 1 minute + <execution time>. Meaning, that every run will get more and more delayed, <execution time> longer after each run
Activity
eigenein commentedon Oct 15, 2024
Apparently, there is another symptom to that. Even if one schedules a run every minute, effectively the in-progress key expires 1 minute after the job finishes. So, the key would actually expire after
1 minute + <execution time>. Meaning, that every run will get more and more delayed,<execution time>longer after each run