File tree Expand file tree Collapse file tree 2 files changed +42
-2
lines changed
Expand file tree Collapse file tree 2 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -57,11 +57,16 @@ def retrieve_work_for_queues(qcmd)
5757 UnitOfWork . new ( *work ) if work
5858 end
5959
60+ # Returns the list of unpause queue names.
61+ #
62+ # @return [Array<String>] The list of unpaused queue names.
6063 def unpaused_queues_cmd
6164 queues = queues_cmd
6265 queues . reject do |q |
63- q != Sidekiq ::BasicFetch ::TIMEOUT &&
64- Sidekiq ::QueuePause . paused? ( q . gsub ( "queue:" , "" ) , Sidekiq ::QueuePause . process_key )
66+ next if q . is_a? ( Integer )
67+ next if q . is_a? ( Hash )
68+
69+ Sidekiq ::QueuePause . paused? ( q . gsub ( "queue:" , "" ) , Sidekiq ::QueuePause . process_key )
6570 end
6671 end
6772 end
Original file line number Diff line number Diff line change 1+ require "spec_helper"
2+
3+ describe Sidekiq ::QueuePause do
4+ describe Sidekiq ::QueuePause ::PausingFetch do
5+ describe "#unpause_queues_cmd" do
6+ let ( :queuename ) { "some_queue" }
7+ let ( :config ) { { queues : [ queuename ] , strict : true } }
8+ let ( :pausing_fetch ) { described_class . new ( config ) }
9+
10+ context "with Sidekiq > 6.5.6 the queues list can contain Hashes" do
11+ let ( :queue_list ) { [ "queue:#{ queuename } " , { timeout : 2 } ] }
12+
13+ before { allow ( pausing_fetch ) . to receive ( :queues_cmd ) . and_return ( queue_list ) }
14+
15+ it "does not checked whether the Hash is paused" do
16+ expect ( Sidekiq ::QueuePause ) . to receive ( :paused? ) . with ( queuename , Sidekiq ::QueuePause . process_key ) . and_return ( false )
17+
18+ expect ( pausing_fetch . unpaused_queues_cmd ) . to match_array ( queue_list )
19+ end
20+ end
21+
22+ context "with Sidekiq < 6.5.6 the queues list can contain an Integer" do
23+ let ( :queue_list ) { [ "queue:#{ queuename } " , 2 ] }
24+
25+ before { allow ( pausing_fetch ) . to receive ( :queues_cmd ) . and_return ( queue_list ) }
26+
27+ it "does not check whether the Integer is paused" do
28+ expect ( Sidekiq ::QueuePause ) . to receive ( :paused? ) . with ( queuename , Sidekiq ::QueuePause . process_key ) . and_return ( false )
29+
30+ expect ( pausing_fetch . unpaused_queues_cmd ) . to match_array ( queue_list )
31+ end
32+ end
33+ end
34+ end
35+ end
You can’t perform that action at this time.
0 commit comments