Skip to content

Commit

Permalink
fix redis deprecation warning
Browse files Browse the repository at this point in the history
`Redis#exists(key)` will return an Integer in redis-rb 4.3. `exists?` returns a boolean, you should use it instead. To opt-in to the new behavior now you can set Redis.exists_returns_integer =  true. To disable this message and keep the current (boolean) behaviour of 'exists' you can set `Redis.exists_returns_integer = false`, but this option will be removed in 5.0.
  • Loading branch information
Wolfer committed Mar 19, 2021
1 parent 41990aa commit 74b742c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/sidekiq-scheduler/redis_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ def self.get_all_schedules
#
# @return [Boolean] true if the schedules key is set, false otherwise
def self.schedule_exist?
Sidekiq.redis { |r| r.exists(:schedules) }
Sidekiq.redis do |r|
if r.respond_to?(:exists?)
r.exists?(:schedules)
else
!!r.exists(:schedules)
end
end
end

# Returns all the schedule changes for a given time range.
Expand Down

0 comments on commit 74b742c

Please sign in to comment.