diff --git a/Changes.md b/Changes.md index ca65a52a..98085aaa 100644 --- a/Changes.md +++ b/Changes.md @@ -2,6 +2,12 @@ [Sidekiq Changes](https://github.com/mperham/sidekiq/blob/main/Changes.md) | [Sidekiq Pro Changes](https://github.com/mperham/sidekiq/blob/main/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/mperham/sidekiq/blob/main/Ent-Changes.md) +6.5.6 +---------- + +- Fix deprecation warnings with redis-rb 4.8.0 [#5484] +- Lock redis-rb to < 5.0 as we are moving to redis-client in Sidekiq 7.0 + 6.5.5 ---------- diff --git a/Ent-Changes.md b/Ent-Changes.md index 031c19cf..d1749a4e 100644 --- a/Ent-Changes.md +++ b/Ent-Changes.md @@ -4,6 +4,11 @@ Please see [sidekiq.org](https://sidekiq.org) for more details and how to buy. +2.5.2 +--------- + +- Remove Redis 4.8.0 deprecation warnings + 2.5.1 ------------- diff --git a/Pro-Changes.md b/Pro-Changes.md index fa690ff5..2c2bb21d 100644 --- a/Pro-Changes.md +++ b/Pro-Changes.md @@ -4,6 +4,11 @@ Please see [sidekiq.org](https://sidekiq.org/) for more details and how to buy. +5.5.3 +--------- + +- Remove Redis 4.8.0 deprecation warnings + 5.5.2 --------- diff --git a/lib/sidekiq/api.rb b/lib/sidekiq/api.rb index c710d348..4c65f4e2 100644 --- a/lib/sidekiq/api.rb +++ b/lib/sidekiq/api.rb @@ -303,7 +303,7 @@ module Sidekiq Sidekiq.redis do |conn| conn.multi do |transaction| transaction.unlink(@rname) - transaction.srem("queues", name) + transaction.srem("queues", [name]) end end true diff --git a/lib/sidekiq/client.rb b/lib/sidekiq/client.rb index 1316b77f..c152204d 100644 --- a/lib/sidekiq/client.rb +++ b/lib/sidekiq/client.rb @@ -244,7 +244,7 @@ module Sidekiq entry["enqueued_at"] = now Sidekiq.dump_json(entry) } - conn.sadd("queues", queue) + conn.sadd("queues", [queue]) conn.lpush("queue:#{queue}", to_push) end end diff --git a/lib/sidekiq/fetch.rb b/lib/sidekiq/fetch.rb index f297e4ef..266f55a9 100644 --- a/lib/sidekiq/fetch.rb +++ b/lib/sidekiq/fetch.rb @@ -34,7 +34,7 @@ module Sidekiq # :nodoc: @queues = config.queues.map { |q| "queue:#{q}" } if @strictly_ordered_queues @queues.uniq! - @queues << TIMEOUT + @queues << {timeout: TIMEOUT} end end @@ -84,7 +84,7 @@ module Sidekiq # :nodoc: else permute = @queues.shuffle permute.uniq! - permute << TIMEOUT + permute << {timeout: TIMEOUT} permute end end diff --git a/lib/sidekiq/launcher.rb b/lib/sidekiq/launcher.rb index ba0154f8..407c7671 100644 --- a/lib/sidekiq/launcher.rb +++ b/lib/sidekiq/launcher.rb @@ -89,7 +89,7 @@ module Sidekiq # doesn't actually exit, it'll reappear in the Web UI. redis do |conn| conn.pipelined do |pipeline| - pipeline.srem("processes", identity) + pipeline.srem("processes", [identity]) pipeline.unlink("#{identity}:work") end end @@ -153,7 +153,7 @@ module Sidekiq _, exists, _, _, msg = redis { |conn| conn.multi { |transaction| - transaction.sadd("processes", key) + transaction.sadd("processes", [key]) transaction.exists(key) transaction.hmset(key, "info", to_json, "busy", curstate.size, diff --git a/test/api.rb b/test/api.rb index 085af3c4..57947d6c 100644 --- a/test/api.rb +++ b/test/api.rb @@ -106,8 +106,7 @@ describe "API" do describe "workers_size" do it "retrieves the number of busy workers" do @cfg.redis do |c| - c.sadd("processes", "process_1") - c.sadd("processes", "process_2") + c.sadd("processes", ["process_1", "process_2"]) c.hset("process_1", "busy", 1) c.hset("process_2", "busy", 2) end @@ -125,10 +124,10 @@ describe "API" do it "returns a hash of queue and size in order" do @cfg.redis do |conn| conn.rpush "queue:foo", "{}" - conn.sadd "queues", "foo" + conn.sadd "queues", ["foo"] 3.times { conn.rpush "queue:bar", "{}" } - conn.sadd "queues", "bar" + conn.sadd "queues", ["bar"] end assert_equal({"foo" => 1, "bar" => 3}, Sidekiq::Stats.new.queues) @@ -139,7 +138,7 @@ describe "API" do it "handles latency for good jobs" do @cfg.redis do |conn| conn.rpush "queue:default", "{\"enqueued_at\": #{Time.now.to_f}}" - conn.sadd "queues", "default" + conn.sadd "queues", ["default"] end s = Sidekiq::Stats.new assert s.default_queue_latency > 0 @@ -150,7 +149,7 @@ describe "API" do it "handles latency for incomplete jobs" do @cfg.redis do |conn| conn.rpush "queue:default", "{}" - conn.sadd "queues", "default" + conn.sadd "queues", ["default"] end s = Sidekiq::Stats.new assert_equal 0, s.default_queue_latency @@ -161,10 +160,10 @@ describe "API" do it "returns total enqueued jobs" do @cfg.redis do |conn| conn.rpush "queue:foo", "{}" - conn.sadd "queues", "foo" + conn.sadd "queues", ["foo"] 3.times { conn.rpush "queue:bar", "{}" } - conn.sadd "queues", "bar" + conn.sadd "queues", ["bar"] end s = Sidekiq::Stats.new @@ -538,9 +537,9 @@ describe "API" do time = Time.now.to_f @cfg.redis do |conn| conn.multi do |transaction| - transaction.sadd("processes", odata["key"]) + transaction.sadd("processes", [odata["key"]]) transaction.hmset(odata["key"], "info", Sidekiq.dump_json(odata), "busy", 10, "beat", time) - transaction.sadd("processes", "fake:pid") + transaction.sadd("processes", ["fake:pid"]) end end @@ -569,7 +568,7 @@ describe "API" do key = "#{hn}:#{$$}" pdata = {"pid" => $$, "hostname" => hn, "started_at" => Time.now.to_i} @cfg.redis do |conn| - conn.sadd("processes", key) + conn.sadd("processes", [key]) conn.hmset(key, "info", Sidekiq.dump_json(pdata), "busy", 0, "beat", Time.now.to_f) end @@ -621,17 +620,14 @@ describe "API" do data = {"pid" => rand(10_000), "hostname" => "app#{rand(1_000)}", "started_at" => Time.now.to_f} key = "#{data["hostname"]}:#{data["pid"]}" @cfg.redis do |conn| - conn.sadd("processes", key) + conn.sadd("processes", [key]) conn.hmset(key, "info", Sidekiq.dump_json(data), "busy", 0, "beat", Time.now.to_f) end - ps = Sidekiq::ProcessSet.new assert_equal 1, ps.size - assert_equal 1, ps.to_a.size @cfg.redis do |conn| - conn.sadd("processes", "bar:987") - conn.sadd("processes", "bar:986") + conn.sadd("processes", ["bar:987", "bar:986"]) conn.del("process_cleanup") end diff --git a/test/fetch.rb b/test/fetch.rb index c7194160..bcf86205 100644 --- a/test/fetch.rb +++ b/test/fetch.rb @@ -33,7 +33,7 @@ describe Sidekiq::BasicFetch do @cap.queues = ["basic", "bar"] fetch = Sidekiq::BasicFetch.new(@cap) cmd = fetch.queues_cmd - assert_equal cmd, ["queue:basic", "queue:bar", Sidekiq::BasicFetch::TIMEOUT] + assert_equal cmd, ["queue:basic", "queue:bar", {timeout: Sidekiq::BasicFetch::TIMEOUT}] end it "bulk requeues" do diff --git a/test/scheduled.rb b/test/scheduled.rb index 3b85fc88..6418950f 100644 --- a/test/scheduled.rb +++ b/test/scheduled.rb @@ -129,7 +129,7 @@ describe Sidekiq::Scheduled do with_sidekiq_option(:average_scheduled_poll_interval, 10) do 3.times do |i| @config.redis do |conn| - conn.sadd("processes", "process-#{i}") + conn.sadd("processes", ["process-#{i}"]) conn.hset("process-#{i}", "info", "") end end diff --git a/test/web.rb b/test/web.rb index e3cf7850..8087a36e 100644 --- a/test/web.rb +++ b/test/web.rb @@ -62,7 +62,7 @@ describe Sidekiq::Web do it "can display workers" do @config.redis do |conn| conn.incr("busy") - conn.sadd("processes", "foo:1234") + conn.sadd("processes", ["foo:1234"]) conn.hmset("foo:1234", "info", Sidekiq.dump_json("hostname" => "foo", "started_at" => Time.now.to_f, "queues" => [], "concurrency" => 10), "at", Time.now.to_f, "busy", 4) identity = "foo:1234:work" hash = {queue: "critical", payload: {"class" => WebWorker.name, "args" => [1, "abc"]}, run_at: Time.now.to_i} @@ -152,7 +152,7 @@ describe Sidekiq::Web do it "can delete a queue" do @config.redis do |conn| conn.rpush("queue:foo", "{\"args\":[],\"enqueued_at\":1567894960}") - conn.sadd("queues", "foo") + conn.sadd("queues", ["foo"]) end get "/queues/foo" @@ -442,7 +442,7 @@ describe Sidekiq::Web do # on /workers page @config.redis do |conn| pro = "foo:1234" - conn.sadd("processes", pro) + conn.sadd("processes", [pro]) conn.hmset(pro, "info", Sidekiq.dump_json("started_at" => Time.now.to_f, "labels" => ["frumduz"], "queues" => [], "concurrency" => 10), "busy", 1, "beat", Time.now.to_f) identity = "#{pro}:work" hash = {queue: "critical", payload: {"class" => "FailWorker", "args" => ["hello"]}, run_at: Time.now.to_i} @@ -517,7 +517,7 @@ describe Sidekiq::Web do @config.redis do |conn| conn.set("stat:processed", 5) conn.set("stat:failed", 2) - conn.sadd("queues", "default") + conn.sadd("queues", ["default"]) end 2.times { add_retry } 3.times { add_scheduled } @@ -571,8 +571,7 @@ describe Sidekiq::Web do @config.redis do |conn| conn.set("stat:processed", 5) conn.set("stat:failed", 2) - conn.sadd("queues", "default") - conn.sadd("queues", "queue2") + conn.sadd("queues", ["default", "queue2"]) end 2.times { add_retry } 3.times { add_scheduled } @@ -715,7 +714,7 @@ describe Sidekiq::Web do msg = "{\"queue\":\"default\",\"payload\":{\"retry\":true,\"queue\":\"default\",\"timeout\":20,\"backtrace\":5,\"class\":\"HardWorker\",\"args\":[\"bob\",10,5],\"jid\":\"2b5ad2b016f5e063a1c62872\"},\"run_at\":1361208995}" @config.redis do |conn| conn.multi do |transaction| - transaction.sadd("processes", key) + transaction.sadd("processes", [key]) transaction.hmset(key, "info", Sidekiq.dump_json("hostname" => "foo", "started_at" => Time.now.to_f, "queues" => []), "at", Time.now.to_f, "busy", 4) transaction.hmset("#{key}:work", Time.now.to_f, msg) end diff --git a/test/web_helpers.rb b/test/web_helpers.rb index 0d453b2d..d271212a 100644 --- a/test/web_helpers.rb +++ b/test/web_helpers.rb @@ -153,7 +153,7 @@ describe "Web helpers" do key = "#{hostname}:123" Sidekiq.redis do |conn| - conn.sadd("processes", key) + conn.sadd("processes", [key]) conn.hmset(key, "info", Sidekiq.dump_json(pdata), "busy", 0, "beat", Time.now.to_f) end end