Class: ServerEngine::MultiSpawnServer

Inherits:
MultiWorkerServer show all
Defined in:
lib/serverengine/multi_spawn_server.rb

Instance Attribute Summary

Attributes included from ConfigLoader

#config, #logger

Instance Method Summary collapse

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) ⇒ MultiSpawnServer

Returns a new instance of MultiSpawnServer.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/serverengine/multi_spawn_server.rb', line 25

def initialize(worker_module, load_config_proc={}, &block)
  if ServerEngine.windows?
    @pm = ProcessManager.new(
      auto_tick: false,
      graceful_kill_signal: Signals::GRACEFUL_STOP,
      immediate_kill_signal: false,
      enable_heartbeat: false,
    )
  else
    @pm = ProcessManager.new(
      auto_tick: false,
      graceful_kill_signal: Signals::GRACEFUL_STOP,
      immediate_kill_signal: Signals::IMMEDIATE_STOP,
      enable_heartbeat: false,
    )
  end

  super(worker_module, load_config_proc, &block)

  @reload_signal = @config[:worker_reload_signal]
  @unrecoverable_exit_codes = @config.fetch(:unrecoverable_exit_codes, [])
  @pm.command_sender = @command_sender
end

Instance Method Details

#logger=(logger) ⇒ Object



55
56
57
58
# File 'lib/serverengine/multi_spawn_server.rb', line 55

def logger=(logger)
  super
  @pm.logger = logger
end

#runObject



49
50
51
52
53
# File 'lib/serverengine/multi_spawn_server.rb', line 49

def run
  super
ensure
  @pm.close
end