Class: ServerEngine::MultiProcessServer
- Inherits:
-
MultiWorkerServer
- Object
- Server
- MultiWorkerServer
- ServerEngine::MultiProcessServer
- Defined in:
- lib/serverengine/multi_process_server.rb
Defined Under Namespace
Classes: WorkerMonitor
Instance Attribute Summary
Attributes included from ConfigLoader
Instance Method Summary collapse
-
#initialize(worker_module, load_config_proc = {}, &block) ⇒ MultiProcessServer
constructor
A new instance of MultiProcessServer.
- #logger=(logger) ⇒ Object
- #run ⇒ Object
Methods inherited from MultiWorkerServer
#join_workers, #reload, #restart, #scale_workers, #stop
Methods inherited from Server
#after_run, #after_start, #before_run, #dump, #install_signal_handlers, #main, #reload, #restart, #stop
Constructor Details
#initialize(worker_module, load_config_proc = {}, &block) ⇒ MultiProcessServer
Returns a new instance of MultiProcessServer.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/serverengine/multi_process_server.rb', line 26 def initialize(worker_module, load_config_proc={}, &block) @pm = ProcessManager.new( auto_tick: false, graceful_kill_signal: Signals::GRACEFUL_STOP, immediate_kill_signal: Signals::IMMEDIATE_STOP, enable_heartbeat: true, auto_heartbeat: true, on_heartbeat_error: Proc.new do @logger.fatal "parent process unexpectedly terminated" exit 1 end ) super(worker_module, load_config_proc, &block) @worker_process_name = @config[:worker_process_name] @unrecoverable_exit_codes = @config.fetch(:unrecoverable_exit_codes, []) end |
Instance Method Details
#logger=(logger) ⇒ Object
51 52 53 54 |
# File 'lib/serverengine/multi_process_server.rb', line 51 def logger=(logger) super @pm.logger = logger end |
#run ⇒ Object
45 46 47 48 49 |
# File 'lib/serverengine/multi_process_server.rb', line 45 def run super ensure @pm.close end |