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: Redis#exists(key) Warning from redis 4.2.0 #288
Fix: Redis#exists(key) Warning from redis 4.2.0 #288
Conversation
@ondrejbartas any idea if this can make it into a patch? Any ideas on the CI? I wonder if this needs to handle multiple versions of Redis and use |
Would it be enough to just add an explicit dependency on redis >= 4.2.0 to sidekiq-cron? |
Hi @ondrejbartas! Any news on this? |
@ondrejbartas What can be done to get this completed? I'm worried that this gem should be treated as abandoned. Is there anything we can do to help? |
Checking out the Travis logs, we see that using Ruby <= 2.4, we get this error:
Since this PR now requires Redis >= 4.2 in the gemspec, this should be fine. Strange. |
@swiknaba - Thank you for spotting that duplication :) My preference right now is drop support for older Ruby/RoR versions if it helps get this update in. Though I've not heard anything from @ondrejbartas :/ @ondrejbartas - Do you have a BuyMeACoffee page? I'd gladly pay a little towards to helping fix this warning :) |
@MikeRogers0 : If you add the following to the PR I think you can resolve the errors in the testsuite: unless Redis.instance_methods(false).include? :exists?
class Redis
alias exists? exists
end
end or the following for a short form, though I'd prefer the one above: class Redis
alias exists? exists unless instance_methods(false).include? :exists?
end |
Instead of globally polluting the Redis class, we could also just pull the correct method right on the spot and make clear in the code, that this is due to a change in the Redis gem starting with version 4.2: REDIS_EXISTS_METHOD = Gem.loaded_specs['redis'].version < Gem::Version.new('4.2') ? :exists : :exists?
conn.send(REDIS_EXISTS_METHOD, job_enqueued_key) maybe also add an Issue in either case, to remove this hack-around/monkey-patch when dropping support for Redis < 4.2 (after merging this PR). |
I added @swiknaba change in, it passed locally 🤞 travis CI passes. I'm also going to update this PR to not change the |
Fix: Redis#exists(key) Warning from redis 4.2.0 sidekiq-cron#288
Thanks for solving this (and for this awesome gem ❤️ )! |
@ondrejbartas is it possible to get gem release? We are getting github auth problems in our build system. |
@swiknaba @ondrejbartas - any update on this? |
I'm not a maintainer and thus, sadly, can't publish a release. |
Is there any chance, that a new release gets published in the near future? |
@ondrejbartas let me know if you want to open up sponsors for the project? Would be happy to sponsor to get new versions cut every once in awhile. |
This fixes the deprecation warning:
Approach
I think we're safe to replace instances of
Redis#exists(key)
withRedis#exists?(key)
. It has been updated to conditionally change the method being used depending on the Redis version being used.Try it now
Update your gemfile to use
Related Tickets
Closes #286
If you liked this PR, please consider buying me a coffee :)