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

Erroring out if retry is enabled #9

Open
maltoe opened this issue Nov 16, 2018 · 5 comments
Open

Erroring out if retry is enabled #9

maltoe opened this issue Nov 16, 2018 · 5 comments

Comments

@maltoe
Copy link
Contributor

maltoe commented Nov 16, 2018

Hey

I was wondering whether it would be a good change to refuse scheduling if the retry option of sidekiq is not set to false. Currently, if retry: true is set, you might end up with multiple jobs running at the same time (one scheduled, one or more retried by Sidekiq). This behaviour seems bad, and my guess is that all users of sidekiq-repeat have retry: false on their jobs.

Or at least issue a warning?

@dsander
Copy link
Member

dsander commented Nov 19, 2018

Currently, if retry: true is set, you might end up with multiple jobs running at the same time (one scheduled, one or more retried by Sidekiq).

I think that is something that should be taken care of by sidekiq-unique-jobs or a similar gem. There are scenarios where retry: true for a recurring job is useful. One could try to hit an external service every hour, but still retry it a few times if the service is down or flaky at the time of the execution of the job.
We could try to be smart and output a warning if the amount of retries configured would make the job retry longer than the configured recurrence.

@bigzed
Copy link
Member

bigzed commented Nov 19, 2018

We could try to be smart and output a warning if the amount of retries configured would make the job retry longer than the configured recurrence.

In general I agree with @dsander, but the smartest solution would probably be to not only issue a warning, but refuse to retry if the next retry would be after the next scheduled job.
Retries which happen before the next scheduled job, would of course be executed.

@maltoe
Copy link
Contributor Author

maltoe commented Nov 19, 2018

@bigzed That would be smart, but I wonder if we can manipulate Sidekiq's retry mechanism at all from within the middleware.

@dsander
Copy link
Member

dsander commented Nov 19, 2018

I am not even sure if the calculation would work in all cases. If parse-cron supports crazy cronlines we would need to brute force the shortest possible time-frame between two runs of the passed in cronline 😄

@maltoe
Copy link
Contributor Author

maltoe commented Nov 20, 2018

Maybe we simply do nothing about it, but mention it in the README as well?

Make sure to turn of retry or at least make sure it fades off before the next scheduled time

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

3 participants