Module: SolidQueue::Processes::Runnable

Includes:
Supervised
Included in:
Poller, Scheduler
Defined in:
lib/solid_queue/processes/runnable.rb

Instance Method Summary collapse

Methods included from Supervised

#supervised_by

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/solid_queue/processes/runnable.rb', line 30

def alive?
  !running_async? || @thread&.alive?
end

#mode=(value) ⇒ Object



7
8
9
# File 'lib/solid_queue/processes/runnable.rb', line 7

def mode=(value)
  @mode = (value || DEFAULT_MODE).to_s.inquiry
end

#startObject



11
12
13
14
15
16
# File 'lib/solid_queue/processes/runnable.rb', line 11

def start
  run_in_mode do
    boot
    run
  end
end

#stopObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/solid_queue/processes/runnable.rb', line 18

def stop
  super
  wake_up

  # When not supervised, block until the thread terminates for backward
  # compatibility with code that expects stop to be synchronous.
  # When supervised, the supervisor controls the shutdown timeout.
  unless supervised?
    @thread&.join
  end
end