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

Fix deprecated method and testing #153

Merged
merged 7 commits into from
Dec 28, 2023

Conversation

leedrum
Copy link
Contributor

@leedrum leedrum commented Dec 19, 2023

changes:

  • gem minitest has changed the name of the module from MiniTest to Minitest
  • method zrangebyscore of Redis is deprecated. It should be zrange with 1 more params ("BYSCORE")
  • The Sidekiq config has been changed (reverted, we will support Sidekiq 7.x later)
  • Change Sidekiq URL to match Redis default config at local.
  • Refacto typos

before fixing:

Finished in 0.088193s, 430.8732 runs/s, 0.0000 assertions/s.
38 runs, 0 assertions, 0 failures, 37 errors, 0 skips

after fixing:

Run options: --seed 40605

# Running:

......................................

Finished in 0.181538s, 209.3226 runs/s, 947.4600 assertions/s.
38 runs, 172 assertions, 0 failures, 0 errors, 0 skips

Copy link
Collaborator

@mcasper mcasper left a comment

Choose a reason for hiding this comment

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

@leedrum Thank you for the contribution! A couple small things to address, and then I think we can get this merged

@leedrum
Copy link
Contributor Author

leedrum commented Dec 22, 2023

@mcasper Thank you for the comments. I have fixed it. Could you take a look?

results = conn.zrangebyscore(Sidekiq::Failures::LIST_KEY, score, score)
# after Redis v6.2.0, zrangebyscore is deprecated and zrange with BYSCORE is used
results = if Gem::Version.new(conn.info["redis_version"].to_s) > Gem::Version.new('6.2.0')
conn.zrange(Sidekiq::Failures::LIST_KEY, score, score, "BYSCORE")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually I think this needs some slight tweaks: https://rubydoc.info/gems/redis/Redis/Commands/SortedSets#zrange-instance_method

Suggested change
conn.zrange(Sidekiq::Failures::LIST_KEY, score, score, "BYSCORE")
conn.zrange(Sidekiq::Failures::LIST_KEY, score.to_i, score.to_i, by_score: true)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@leedrum
Copy link
Contributor Author

leedrum commented Dec 26, 2023

@mcasper I fixed the comment. tks

@leedrum
Copy link
Contributor Author

leedrum commented Dec 27, 2023

The CI still doesn't pass. I will fix it

@leedrum
Copy link
Contributor Author

leedrum commented Dec 27, 2023

@mcasper I have fixed the comments and the CI run successfully.
Take a look when you have time

@mcasper mcasper merged commit 447ff21 into mhfs:master Dec 28, 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.

2 participants