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

Support Sidekiq Pro super_fetch #178

Closed
wants to merge 17 commits into from

Conversation

mnovelo
Copy link
Contributor

@mnovelo mnovelo commented Jan 16, 2024

Distilling the discussions in this issue and the work in this fork, this adds support for Sidekiq Pro's super_fetch for v1 of sidekiq-throttled and v7.x of Sidekiq Pro.

Copy link

codecov bot commented Jan 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (bf88735) 98.94% compared to head (3c649ed) 98.95%.

❗ Current head 3c649ed differs from pull request most recent head ea96cc3. Consider uploading reports for the commit ea96cc3 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #178   +/-   ##
=======================================
  Coverage   98.94%   98.95%           
=======================================
  Files          18       18           
  Lines         380      381    +1     
  Branches       53       53           
=======================================
+ Hits          376      377    +1     
  Misses          4        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mnovelo mnovelo force-pushed the sidekiq-pro-super-fetch branch from dc53aff to c39ca9a Compare January 16, 2024 17:49
Co-authored-by: Alexey Zapparov <alexey@zapparov.com>
Signed-off-by: Mauricio Novelo <mauricio.novelo@gmail.com>
@ixti

This comment was marked as resolved.

spec/support/sidekiq.rb Outdated Show resolved Hide resolved
spec/support/sidekiq.rb Outdated Show resolved Hide resolved
@ixti ixti requested a review from freemanoid January 16, 2024 18:33
@mnovelo mnovelo requested a review from ixti January 16, 2024 19:05
@mnovelo mnovelo requested a review from ixti January 17, 2024 01:50
@mnovelo mnovelo requested a review from ixti January 17, 2024 13:33
@ixti
Copy link
Owner

ixti commented Jan 17, 2024

After taking another look, I think there's a better way to exclude Sidekiq-Pro specs when it's not available. Let's add this change to spec_helper.rb:

diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index cb34b71..661327d 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -61,6 +61,9 @@ RSpec.configure do |config|
   # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
   config.filter_run_when_matching :focus
 
+  # Skip tests that require Sidekiq-Pro
+  config.filter_run_excluding sidekiq_pro: true unless defined? Sidekiq::Pro
+
   # Allows RSpec to persist some state between runs in order to support
   # the `--only-failures` and `--next-failure` CLI options. We recommend
   # you configure your source control system to ignore this file.

Then spec/lib/sidekiq/throttled/patches/super_fetch_spec.rb will become:

RSpec.describe Sidekiq::Throttled::Patches::SuperFetch, :sidekiq_pro do
  let(:base_queue) { "default" }
  ...

So that spec suite will run only when Sidekiq-Pro is available, or when one runs it explicitly with:

bundle exec rspec --tag sidekiq_pro

Copy link
Owner

@ixti ixti left a comment

Choose a reason for hiding this comment

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

Looks good to me. @freemanoid please take another look.

@ixti
Copy link
Owner

ixti commented Jan 18, 2024

@mnovelo I've added the above proposals (and a bit more) to a separate branch

@ixti
Copy link
Owner

ixti commented Jan 18, 2024

Can you please check if the updated instructions make sense and specs pass for you https://github.com/ixti/sidekiq-throttled/tree/sidekiq-pro-super-fetch - and if so - I will merge it

@mnovelo
Copy link
Contributor Author

mnovelo commented Jan 18, 2024

Thanks! I was just wrapping them up and taking care of the Rubocop Metrics/CyclomaticComplexity: Cyclomatic complexity for active_queues is too high. warning. Will push in a moment

@ixti
Copy link
Owner

ixti commented Jan 18, 2024

Thanks! I was just wrapping them up and taking care of the Rubocop Metrics/CyclomaticComplexity: Cyclomatic complexity for active_queues is too high. warning. Will push in a moment

Oh. hm... I wonder why Metrics/CyclomaticComplexity fails. It's not that complex LOL

@mnovelo
Copy link
Contributor Author

mnovelo commented Jan 18, 2024

Just added a change that removes some redundant safe operators since nil.to_a.to_h becomes {}. That took care of it 😊

@ixti
Copy link
Owner

ixti commented Jan 18, 2024

I'm gonna squash merge this PR in a bit!

@mnovelo
Copy link
Contributor Author

mnovelo commented Jan 18, 2024

sorry, one moment. Specs aren't passing now

@ixti
Copy link
Owner

ixti commented Jan 18, 2024

Oh.. Yeah. I'll wait.

@ixti
Copy link
Owner

ixti commented Jan 18, 2024

sorry, one moment. Specs aren't passing now

Make sure to cp .rspec.sidekiq-pro .rspec-local, by default :sidekiq_pro tests are disabled, and .rspec.sidekiq-pro is a version of .rspec that does not filter them out.

@mnovelo
Copy link
Contributor Author

mnovelo commented Jan 18, 2024

Oh it's the 6.5 specs that are failing. I had it set to skip Sidekiq Pro < 7 since it uses a different config. For some reason, now they're running

@mnovelo
Copy link
Contributor Author

mnovelo commented Jan 18, 2024

Weird fluke in my local environment. Now everything is back and passing 😖 Anyway, ready to merge!

@mnovelo
Copy link
Contributor Author

mnovelo commented Jan 18, 2024

@ixti I applied this suggestion using the GitHub UI but it didn't get signed. Do you need me to fix that or does it not matter since you're gonna squash and merge?

@ixti
Copy link
Owner

ixti commented Jan 18, 2024

@ixti I applied this suggestion using the GitHub UI but it didn't get signed. Do you need me to fix that or does it not matter since you're gonna squash and merge?

@mnovelo Yeah. Gonna squash merge it. So. don't worry about commits not being signed :D

@ixti ixti closed this in ecc602b Jan 18, 2024
@mnovelo mnovelo deleted the sidekiq-pro-super-fetch branch January 18, 2024 16:56
@ixti
Copy link
Owner

ixti commented Jan 18, 2024

@mnovelo Thank you very much! I'm gonna cut 1.3.0 release. and in 2.0.0 sidekiq 6.x will be fully dropped, so I am not worried about it :D

@ixti
Copy link
Owner

ixti commented Jan 18, 2024

Released. Thank you very much to all who participated in this journey! ❤️

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