Class: FiberJob::ProcessManager
- Inherits:
-
Object
- Object
- FiberJob::ProcessManager
- Defined in:
- lib/fiber_job/process_manager.rb
Overview
ProcessManager is the single entry point for running FiberJob workers. It manages worker lifecycle, configuration, signal handling, and graceful shutdown.
This is the recommended way to start FiberJob workers and should be used instead of directly instantiating Worker objects.
Class Method Summary collapse
-
.start_worker(config: nil, queues: nil, concurrency: nil) ⇒ void
Starts a FiberJob worker process with proper signal handling and lifecycle management.
Class Method Details
.start_worker(config: nil, queues: nil, concurrency: nil) ⇒ void
This method returns an undefined value.
Starts a FiberJob worker process with proper signal handling and lifecycle management. This is the main entry point for running FiberJob workers.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/fiber_job/process_manager.rb', line 37 def start_worker(config: nil, queues: nil, concurrency: nil) config ||= FiberJob.config queues ||= config.queues concurrency ||= config.concurrency # Auto-load job classes if paths are configured config.load_jobs! if config.job_paths&.any? log_startup_info(config, queues, concurrency) worker = create_worker(config: config, queues: queues, concurrency: concurrency) setup_signal_handlers(worker) begin worker.start rescue => e config.logger.error "Failed to start FiberJob worker: #{e.message}" config.logger.error e.backtrace.join("\n") exit 1 end end |