Skip to content

Commit

Permalink
Migrate to exists? for redis-rb 4.2, fixes #4591
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Jun 9, 2020
1 parent 3e26e06 commit 6a33404
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion Changes.md
Expand Up @@ -9,7 +9,8 @@ HEAD
- Ensure `Rack::ContentLength` is loaded as middleware for correct Web UI responses [#4541]
- Avoid exception dumping SSL store in Redis connection logging [#4532]
- Better error messages in Sidekiq::Client [#4549]
- Vendor rack-protection/authenticity_token middleware [#4588]
- Remove rack-protection, reimplement CSRF protection [#4588]
- Require redis-rb 4.2.0

6.0.7
---------
Expand Down
8 changes: 4 additions & 4 deletions Gemfile.lock
@@ -1,10 +1,10 @@
PATH
remote: .
specs:
sidekiq (6.0.7)
sidekiq (6.1.0)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.1.0)
redis (>= 4.2.0)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -74,7 +74,7 @@ GEM
byebug (11.1.1)
coderay (1.1.2)
concurrent-ruby (1.1.6)
connection_pool (2.2.2)
connection_pool (2.2.3)
crass (1.0.6)
docile (1.3.2)
erubi (1.9.0)
Expand Down Expand Up @@ -146,7 +146,7 @@ GEM
thor (>= 0.20.3, < 2.0)
rainbow (3.0.0)
rake (13.0.1)
redis (4.1.3)
redis (4.2.0)
redis-namespace (1.7.0)
redis (>= 3.0.4)
rexml (3.2.4)
Expand Down
2 changes: 1 addition & 1 deletion lib/sidekiq/api.rb
Expand Up @@ -921,7 +921,7 @@ def each
procs = conn.sscan_each("processes").to_a
procs.sort.each do |key|
valid, workers = conn.pipelined {
conn.exists(key)
conn.exists?(key)
conn.hgetall("#{key}:workers")
}
next unless valid
Expand Down
2 changes: 1 addition & 1 deletion lib/sidekiq/launcher.rb
Expand Up @@ -157,7 +157,7 @@ def ❤
_, exists, _, _, msg = Sidekiq.redis { |conn|
conn.multi {
conn.sadd("processes", key)
conn.exists(key)
conn.exists?(key)
conn.hmset(key, "info", to_json, "busy", curstate.size, "beat", Time.now.to_f, "quiet", @done)
conn.expire(key, 60)
conn.rpop("#{key}-signals")
Expand Down
2 changes: 1 addition & 1 deletion sidekiq.gemspec
Expand Up @@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
gem.version = Sidekiq::VERSION
gem.required_ruby_version = ">= 2.5.0"

gem.add_dependency "redis", ">= 4.1.0"
gem.add_dependency "redis", ">= 4.2.0"
gem.add_dependency "connection_pool", ">= 2.2.2"
gem.add_dependency "rack", "~> 2.0"
end
2 changes: 1 addition & 1 deletion test/test_api.rb
Expand Up @@ -422,7 +422,7 @@ class WorkerWithTags

Sidekiq.redis do |conn|
refute conn.smembers('queues').include?('foo')
refute conn.exists('queue:foo')
refute conn.exists?('queue:foo')
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/test_web.rb
Expand Up @@ -164,7 +164,7 @@ def perform(a, b)

Sidekiq.redis do |conn|
refute conn.smembers('queues').include?('foo')
refute conn.exists('queue:foo')
refute conn.exists?('queue:foo')
end
end

Expand Down

0 comments on commit 6a33404

Please sign in to comment.