Class: Chore::Strategy::PreForkedWorkerStrategy
- Inherits:
-
Object
- Object
- Chore::Strategy::PreForkedWorkerStrategy
- Includes:
- Ipc
- Defined in:
- lib/chore/strategies/worker/preforked_worker_strategy.rb
Overview
:nodoc:
Constant Summary collapse
- NUM_TO_SIGNAL =
{ '1' => :CHLD, '2' => :INT, '3' => :QUIT, '4' => :TERM, '5' => :USR1 }.freeze
Constants included from Ipc
Ipc::BIG_ENDIAN, Ipc::MSG_BYTES, Ipc::READY_MSG
Instance Method Summary collapse
-
#initialize(manager, opts = {}) ⇒ PreForkedWorkerStrategy
constructor
A new instance of PreForkedWorkerStrategy.
- #start ⇒ Object
- #stop! ⇒ Object
Methods included from Ipc
#add_worker_socket, #child_connection, #clear_ready, #create_master_socket, #delete_socket_file, #ipc_help, #read_msg, #select_sockets, #send_msg, #signal_ready
Constructor Details
#initialize(manager, opts = {}) ⇒ PreForkedWorkerStrategy
Returns a new instance of PreForkedWorkerStrategy.
19 20 21 22 23 24 25 26 27 |
# File 'lib/chore/strategies/worker/preforked_worker_strategy.rb', line 19 def initialize(manager, opts = {}) @options = opts @manager = manager @self_read, @self_write = IO.pipe trap_signals(NUM_TO_SIGNAL, @self_write) @worker_manager = WorkerManager.new(create_master_socket) at_exit { delete_socket_file } @running = true end |
Instance Method Details
#start ⇒ Object
29 30 31 32 33 34 |
# File 'lib/chore/strategies/worker/preforked_worker_strategy.rb', line 29 def start Chore.logger.info "PWS: Starting up worker strategy: #{self.class.name}" Chore.run_hooks_for(:before_first_fork) @worker_manager.create_and_attach_workers worker_assignment_thread end |