Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behaviour on repeated job even if result_ttl > interval #315

Open
salander93 opened this issue Oct 19, 2024 · 1 comment
Open

Comments

@salander93
Copy link

As stated in the README:

IMPORTANT NOTE: If you set up a repeated job, you must ensure that you either do not set a result_ttl value or set one that is larger than the job interval. Otherwise, the job's details will expire, and the job will not be rescheduled.

However, I’m encountering a slightly different issue.

I have set my result_ttl as int(1.5 * interval)

Here is my setup (a semplified one):

  • 1 worker
  • 1 scheduled job (SJ_2m) with an interval of 2 minutes (the job takes 1 minute to complete)
  • 1 scheduled job (SJ_60m) with an interval of 60 minutes (the job takes 10 minutes to complete)

Initially, I created SJ_2m, and it get scheduled and ran smoothly. Then, I added SJ_60m.

Since SJ_2m was created earlier and has already completed successfully, it is now in a SUCCESS state with a TTL of 2 minutes * 1.5 = 3 minutes (180 seconds).

When the next run time for SJ_2m arrives, it is added to the queue, but since the only worker is still busy (e.g., for 6 minutes), SJ_2m must wait. However, because the result_ttl is less than the time the worker becomes available (i.e., less than 6 minutes), the job details expire, and the job disappears, preventing it from being rescheduled.

I’m currently facing this issue in my project, and I believe the note should emphasize that even if you set a result_ttl value larger than the job interval, there is still no guarantee that the job details won’t expire. As a result, the job may not be rescheduled as expected if the worker is unavailable for longer than the result_ttl value.

@owlen
Copy link

owlen commented Dec 2, 2024

I would also suggest that the IMPORTANT NOTE warning be implemented as a check in the code, and potentially throw an exception if result_ttl is set and not larger than the interval.

I was about to offer a PR for this, but seeing 77 open PRs pending, I'm not sure if this project is actively maintained. I would appreciate any input on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants