Skip to content

Commit

Permalink
make worker thread pools private
Browse files Browse the repository at this point in the history
  • Loading branch information
Th3-M4jor committed Feb 16, 2025
1 parent 2a25d7f commit 0b5e0e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/solid_queue/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ class Worker < Processes::Poller
before_shutdown :run_stop_hooks
after_shutdown :run_exit_hooks

attr_accessor :pool

attr_reader :worker_id, :queues

def initialize(**options)
Expand All @@ -29,6 +27,8 @@ def metadata
end

private
attr_reader :pool

def poll
claim_executions.then do |executions|
executions.each do |execution|
Expand Down
6 changes: 3 additions & 3 deletions test/unit/worker_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class WorkerTest < ActiveSupport::TestCase
@worker.start
wait_for_registered_processes(1, timeout: 1.second)

assert_not @worker.pool.shutdown?
assert_not @worker.instance_variable_get(:@pool).shutdown?

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

# And now just wait until the worker tries to heartbeat and realises
# it needs to stop
wait_while_with_timeout(2) { !@worker.pool.shutdown? }
assert @worker.pool.shutdown?
wait_while_with_timeout(2) { !@worker.instance_variable_get(:@pool).shutdown? }
assert @worker.instance_variable_get(:@pool).shutdown?
ensure
SolidQueue.process_heartbeat_interval = old_heartbeat_interval
end
Expand Down

0 comments on commit 0b5e0e7

Please sign in to comment.