Skip to content

Commit 0b5e0e7

Browse files
committed
make worker thread pools private
1 parent 2a25d7f commit 0b5e0e7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/solid_queue/worker.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ class Worker < Processes::Poller
88
before_shutdown :run_stop_hooks
99
after_shutdown :run_exit_hooks
1010

11-
attr_accessor :pool
12-
1311
attr_reader :worker_id, :queues
1412

1513
def initialize(**options)
@@ -29,6 +27,8 @@ def metadata
2927
end
3028

3129
private
30+
attr_reader :pool
31+
3232
def poll
3333
claim_executions.then do |executions|
3434
executions.each do |execution|

test/unit/worker_test.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class WorkerTest < ActiveSupport::TestCase
156156
@worker.start
157157
wait_for_registered_processes(1, timeout: 1.second)
158158

159-
assert_not @worker.pool.shutdown?
159+
assert_not @worker.instance_variable_get(:@pool).shutdown?
160160

161161
process = SolidQueue::Process.first
162162
assert_equal "Worker", process.kind
@@ -165,8 +165,8 @@ class WorkerTest < ActiveSupport::TestCase
165165

166166
# And now just wait until the worker tries to heartbeat and realises
167167
# it needs to stop
168-
wait_while_with_timeout(2) { !@worker.pool.shutdown? }
169-
assert @worker.pool.shutdown?
168+
wait_while_with_timeout(2) { !@worker.instance_variable_get(:@pool).shutdown? }
169+
assert @worker.instance_variable_get(:@pool).shutdown?
170170
ensure
171171
SolidQueue.process_heartbeat_interval = old_heartbeat_interval
172172
end

0 commit comments

Comments
 (0)