Skip to content

Commit 0a7c45b

Browse files
committed
Inject Sidekiq as config
--- Change-type: feature
1 parent 0acf8a2 commit 0a7c45b

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

lib/sidekiq-queue-pause.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def retrieve_work
5555
def retrieve_work_for_queues(qcmd)
5656
#queue, job = redis { |conn| conn.blocking_call(conn.read_timeout + TIMEOUT, "brpop", *qcmd, TIMEOUT) }
5757
queue, job = Sidekiq.redis { |conn| conn.brpop(*qcmd) }
58-
UnitOfWork.new(queue, job, config) if queue
58+
UnitOfWork.new(queue, job, Sidekiq) if queue
5959
end
6060

6161
# Returns the list of unpause queue names.

spec/sidekiq-queue-pause_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@
4040
let(:queue_and_work) { [queue, job.to_json] }
4141

4242
it "does not raise a `NoMethodError: undefined method `redis' for nil:NilClass` due to lack of `config`" do
43-
allow(config).to receive(:redis).and_yield(conn)
4443
allow(Sidekiq).to receive(:redis).and_yield(conn)
4544

46-
expect(described_class::UnitOfWork).to receive(:new).with(queue, job.to_json, config).and_call_original
45+
expect(described_class::UnitOfWork).to receive(:new).with(queue, job.to_json, Sidekiq).and_call_original
4746
#expect(conn).to receive(:blocking_call).with(conn.read_timeout + described_class::TIMEOUT, "brpop", queue, described_class::TIMEOUT)
4847
expect(conn).to receive(:brpop).with(queue)
4948
expect(conn).to receive(:rpush).with(queue, job.to_json)

0 commit comments

Comments
 (0)