Class: SolidQueueGuard::Checks::Runtime::ProcessTopologyCheck

Inherits:
Base
  • Object
show all
Defined in:
lib/solid_queue_guard/checks/runtime/process_topology_check.rb

Constant Summary collapse

EXPECTED_KINDS =
%w[Supervisor Worker Dispatcher Scheduler].freeze

Instance Method Summary collapse

Instance Method Details

#callObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/solid_queue_guard/checks/runtime/process_topology_check.rb', line 9

def call
  with_queue_database do
    kinds = SolidQueue::Process.distinct.pluck(:kind)
    missing = EXPECTED_KINDS - kinds

    if missing == EXPECTED_KINDS
      warn(check_id, 'No Solid Queue processes are running',
           suggestion: 'Start bin/jobs or the Solid Queue supervisor')
    elsif missing.include?('Worker')
      warn(check_id, 'No worker processes detected',
           suggestion: 'Ensure workers are configured in queue.yml and running')
    elsif missing.include?('Dispatcher') && scheduled_work_expected?
      warn(check_id, 'No dispatcher process detected with scheduled work configured')
    else
      pass(check_id, "Solid Queue processes running: #{kinds.sort.join(', ')}")
    end
  end
end