Replace whenever with sidekiq scheduler#14119
Replace whenever with sidekiq scheduler#14119mkllnk merged 5 commits intoopenfoodfoundation:masterfrom
Conversation
After moving the remaining tasks from schedule.rb to sidekiq.yml, we can remove whenever and won't rely on cron any more. That will simplify the setup and migration to a new server.
dacook
left a comment
There was a problem hiding this comment.
Nice work!
I liked whenever, but I can see the advantage to be running any task in the background as a job, which can be queued, retried etc if necessary.
| name, _args = Rake.application.parse_task_string(task_string) | ||
| Rake::Task[name].reenable | ||
| end | ||
| end |
There was a problem hiding this comment.
Nice way to wrap up the existing tasks 🥟
| every: "5m" | ||
| RakeJob: | ||
| args: ["ofn:data:remove_transient_data"] | ||
| cron: "30 4 1 * *" |
There was a problem hiding this comment.
A shame we lose the nice scheduling DSL :(
There was a problem hiding this comment.
A shame we lose the nice scheduling DSL :(
Yes, I tried to keep it. But if you say to run it every month then it starts counting after each deploy and never gets there. It would actually be quite easy to add but I didn't bother about that.
rioug
left a comment
There was a problem hiding this comment.
Good one ! Good to see a dependency removed.
|
I'm testing this on staging and Sidekiq raises an error there: This doesn't happen locally. I wonder what the difference is. While I don't know how to re-produce it locally, I'll try to fix it on staging. |
|
Ah, running in staging environment I can reproduce. |
|
Adding a require statement solved the problem. |
What? Why?
We started using the sidekiq-scheduler when we switched from DelayedJob to Sidekiq. But we never made the effort of moving all scheduled tasks from the whenever schedule to Sidekiq. This PR makes that change.
Depends on:
What should we test?
Release notes
Changelog Category (reviewers may add a label for the release notes):
The title of the pull request will be included in the release notes.
Dependencies
Documentation updates