Class: SolidQueue::Supervisor

Inherits:
Processes::Base show all
Includes:
LifecycleHooks, Maintenance, Pidfiled, Signals
Defined in:
lib/solid_queue/supervisor.rb,
lib/solid_queue/supervisor/signals.rb,
lib/solid_queue/supervisor/pidfiled.rb

Defined Under Namespace

Modules: Maintenance, Pidfiled, Signals Classes: Pidfile

Instance Attribute Summary

Attributes inherited from Processes::Base

#name

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::Registrable

#process_id

Methods included from Processes::Interruptible

#wake_up

Methods included from Processes::Procline

#procline

Constructor Details

#initialize(configuration) ⇒ Supervisor

Returns a new instance of Supervisor.



21
22
23
24
25
26
27
# File 'lib/solid_queue/supervisor.rb', line 21

def initialize(configuration)
  @configuration = configuration
  @forks = {}
  @configured_processes = {}

  super
end

Class Method Details

.start(**options) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/solid_queue/supervisor.rb', line 9

def start(**options)
  SolidQueue.supervisor = true
  configuration = Configuration.new(**options)

  if configuration.configured_processes.any?
    new(configuration).tap(&:start)
  else
    abort "No workers or processed configured. Exiting..."
  end
end

Instance Method Details

#startObject



29
30
31
32
33
34
35
36
37
# File 'lib/solid_queue/supervisor.rb', line 29

def start
  boot
  run_start_hooks

  start_processes
  launch_maintenance_task

  supervise
end

#stopObject



39
40
41
42
# File 'lib/solid_queue/supervisor.rb', line 39

def stop
  super
  run_stop_hooks
end