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 v7: fixes #152

Merged
merged 1 commit into from
Jan 4, 2023
Merged

Sidekiq v7: fixes #152

merged 1 commit into from
Jan 4, 2023

Conversation

jlestavel
Copy link
Contributor

@jlestavel jlestavel commented Jan 4, 2023

I think there are some missing changes to have the gem compatible with Sidekiq v7. The main one is the change on the customization of the "fetching class": it's now fetch_class and not fetch anymore (cf my GH comment).

I recommend to use the "Hide whitespace option" when reviewing, because there is some indentation change in spec/sidekiq/limit_fetch/global/monitor_spec.rb file.

if Sidekiq::LimitFetch.post_7?
options.config[:fetch] = Sidekiq::LimitFetch
capsule_or_options.config[:fetch_class] = Sidekiq::LimitFetch
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I'm not wrong, starting from Sidekiq v7, the option to define a custom "fetcher" is fetch_class, cf https://github.com/mperham/sidekiq/blob/4d3f90ba56dd9f9faa35a18bbdfb1b5cb726ee5c/lib/sidekiq/capsule.rb#L37

@@ -22,6 +22,10 @@ def post_7?
@post_7 ||= Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('7.0.0')
end

def post_6_5?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method is moved to have it public (to be able to use it from tests)

if Sidekiq::LimitFetch.post_7?
options = options.config
end
def start(capsule_or_options)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a renaming to make it clear that the argument maybe a Capsule object or an options Hash, depending on the Sidekiq version

@@ -0,0 +1,17 @@
RSpec.describe Sidekiq::Manager do
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this test to have a better coverage (because this would have failed when upgrading to Sidekiq v7)

@jlestavel jlestavel marked this pull request as ready for review January 4, 2023 12:44
@jlestavel
Copy link
Contributor Author

@rgaufman you might be interested by this one

@rgaufman
Copy link

rgaufman commented Jan 4, 2023

I actually downgraded to sidekiq6 for now but thank you, this is great!

@deanpcmad deanpcmad merged commit cb5b3fe into deanpcmad:master Jan 4, 2023
@deanpcmad
Copy link
Owner

Thanks! 👍

@deanpcmad deanpcmad mentioned this pull request Jan 4, 2023
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