Class: SolidQueue::Supervisor

Inherits:
Processes::Base show all
Includes:
Processes::Signals
Defined in:
lib/solid_queue/supervisor.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Processes::Base

#hostname, #kind, #metadata, #pid

Methods included from AppExecutor

#handle_thread_error, #wrap_in_app_executor

Methods included from Processes::Interruptible

#wake_up

Methods included from Processes::Procline

#procline

Constructor Details

#initialize(*configured_processes) ⇒ Supervisor

Returns a new instance of Supervisor.



16
17
18
19
# File 'lib/solid_queue/supervisor.rb', line 16

def initialize(*configured_processes)
  @configured_processes = Array(configured_processes)
  @forks = {}
end

Class Method Details

.start(mode: :work, load_configuration_from: nil) ⇒ Object



8
9
10
11
12
13
# File 'lib/solid_queue/supervisor.rb', line 8

def start(mode: :work, load_configuration_from: nil)
  SolidQueue.supervisor = true
  configuration = Configuration.new(mode: mode, load_from: load_configuration_from)

  new(*configuration.processes).start
end

Instance Method Details

#startObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/solid_queue/supervisor.rb', line 21

def start
  run_callbacks(:boot) { boot }

  start_forks
  launch_maintenance_task

  supervise
rescue Processes::GracefulTerminationRequested
  graceful_termination
rescue Processes::ImmediateTerminationRequested
  immediate_termination
ensure
  run_callbacks(:shutdown) { shutdown }
end