Almost, but if you have a sidekiq scheduler with some job running, for instance, each minute, you still can get that job picked up by the old worker :)
Sidekiq schedule can schedule new jobs and then old workers can pick them up :) I mentioned this in the post, you can solve the problem by two phase rollout or deployment ordering, this is just one more alternative
Not really. If it's acceptable for the app to stop processing jobs for some time (effectively, you will have less workers than you wanted to) — that's a perfect solution
Ah, wrong thread, sorry. They suggested to run new workers along with old ones, which might have a scheduler inside. The scheduler might be fast enough to enqueue a new job that's unknown to the old worker.
In my case, someone created a job that runs every minute resulting to crashes on any new environment during the first deployment
Are you not sending sidekiq the “quiet” signal to tell it there is a delploy coming? That tells sidekiq to stop fetching jobs but lets it continue with jobs it already started. You tell the old process to be quiet at the start of a deploy and then terminate it at the end of the deploy. The new sidekiq process should already be up and running by then.
As mentioned in the post, there are various solutions for this problem, including deploy orchestration or rollout protocols (you always can run 2 deploys without literally any issues).
In my case, I would have make "old" Sidekiq stop picking up new jobs, wait for all (dozens) web (they might put new jobs) and Sidekiq (they can schedule and handle jobs) services to start and do not process new jobs during this period.
I'll try it out, thanks for the direction. I'm just trying to sit on two chairs: do not report things that are technically not errors (new/renamed job) but report ones that are (misspelled/removed job names).
Isn't it better to do a more controlled rollout? It may very well be that the job actually existed in an old misbehaving variant and the code that enqueued it is in the new version.
10
u/satoramoto Jul 07 '26
If your worker group and web groups are separate, you could also just deploy the worker group before the web group and not run into this problem.
6
u/au5lander Jul 07 '26
Are you not sending sidekiq the “quiet” signal to tell it there is a delploy coming? That tells sidekiq to stop fetching jobs but lets it continue with jobs it already started. You tell the old process to be quiet at the start of a deploy and then terminate it at the end of the deploy. The new sidekiq process should already be up and running by then.
https://sidekiq.org/wiki/Signals
2
u/mperham Sidekiq Jul 07 '26
Sidekiq already handles this automatically for you. They are called retries and they are enabled by default. Have you disabled them?
1
u/TheAtlasMonkey Jul 08 '26
You released a gem and wrote a blog because you could not read the doc.. :slow-clap: