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

Sidekiq callback instead of internals for graceful shutdown #443

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

bdewater
Copy link
Contributor

@bdewater bdewater commented Dec 21, 2023

Happens at the same time as the old code: https://github.com/sidekiq/sidekiq/blob/73c150d0430a8394cadb5cd49218895b113613a0/lib/sidekiq/launcher.rb#L47-L54 but this is less brittle. The docs even give a Iteration-like example in Sidekiq Pro to stop on the quiet signal.

Sidekiq::CLI is only defined when Sidekiq runs as a standalone process. Since 7.0 it can also run embedded in the web server process as Sidekiq::Embedded, and using this hook allows Iteration to be compatible with mode of operation. The same events are fired here: https://github.com/sidekiq/sidekiq/blob/73c150d0430a8394cadb5cd49218895b113613a0/lib/sidekiq/embedded.rb#L24-L30

The callback itself exists since Sidekiq 3.0: sidekiq/sidekiq@3d117e6

Copy link
Contributor

@Mangara Mangara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great call! I see that Sidekiq 3.0 was released in 2014, so dropping support for older versions is not a concern.

lib/job-iteration/integrations/sidekiq.rb Outdated Show resolved Hide resolved
Happens at the same time as the old code: https://github.com/sidekiq/sidekiq/blob/73c150d0430a8394cadb5cd49218895b113613a0/lib/sidekiq/launcher.rb#L47-L54 but this is less brittle.

Sidekiq::CLI is only defined when Sidekiq runs as a standalone process. Since 7.0 it can also run embedded in the web server process, and using this hook allows Iteration to be compatible with mode of operation. The same events are fired here: https://github.com/sidekiq/sidekiq/blob/73c150d0430a8394cadb5cd49218895b113613a0/lib/sidekiq/embedded.rb#L24-L30
@Mangara Mangara merged commit ca7bef9 into Shopify:main Jan 16, 2024
18 checks passed
@bdewater bdewater deleted the sidekiq-callback branch January 17, 2024 13:58
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

Successfully merging this pull request may close these issues.

3 participants