Module: ActiveJob::Launcher

Defined in:
runtime/active_job/launcher.rbs,
runtime/active_job/launcher.rb

Class Method Summary collapse

  • .concurrency ⇒ Object

    How many worker threads start runs: WORKER_CONCURRENCY, one when it is unset or empty.

  • .start ⇒ void

    run the scheduler and the drain loops on new threads of THIS process, registering the logger's periodic flush on that scheduler first (Snails.logger.register_flush), so the beat exists before the loop iterates the registry.

Class Method Details

.concurrency ⇒ Object

How many worker threads start runs: WORKER_CONCURRENCY, one when it is unset or empty. A value that is not a positive integer fails at boot instead of silently running one worker thread against the app's expectation. Public because process.started reports the effective count.



39
# File 'runtime/active_job/launcher.rb', line 39

def self.concurrency: () -> Integer

.start ⇒ void

run the scheduler and the drain loops on new threads of THIS process, registering the logger's periodic flush on that scheduler first (Snails.logger.register_flush), so the beat exists before the loop iterates the registry. The servers call it once per server process, from their connection loop — after any prefork, so every child drains the queue its requests enqueue to. A thread started before the fork would not exist in the children: fork carries only the forking thread. The scheduler and the drain loops are separate loops so a slow job cannot delay a periodic beat. WORKER_CONCURRENCY decides the worker thread count, one by default: throughput and FIFO order stay unchanged unless the app opts in.



20
# File 'runtime/active_job/launcher.rb', line 20

def self.start: () -> void