Class: Chore::Strategy::PreforkedWorker
- Inherits:
-
Object
- Object
- Chore::Strategy::PreforkedWorker
- Defined in:
- lib/chore/strategies/worker/helpers/preforked_worker.rb
Overview
:nodoc:
Constant Summary
Constants included from Ipc
Ipc::BIG_ENDIAN, Ipc::MSG_BYTES, Ipc::READY_MSG
Instance Method Summary collapse
-
#initialize(_opts = {}) ⇒ PreforkedWorker
constructor
A new instance of PreforkedWorker.
- #start_worker(master_socket) ⇒ 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
Methods included from Util
Constructor Details
#initialize(_opts = {}) ⇒ PreforkedWorker
Returns a new instance of PreforkedWorker.
12 13 14 15 16 17 18 |
# File 'lib/chore/strategies/worker/helpers/preforked_worker.rb', line 12 def initialize(_opts = {}) Chore.logger.info "PFW: #{Process.pid} initializing" @manager_pid = Process.ppid @consumer_cache = {} @running = true post_fork_setup end |
Instance Method Details
#start_worker(master_socket) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/chore/strategies/worker/helpers/preforked_worker.rb', line 20 def start_worker(master_socket) Chore.logger.info 'PFW: Worker starting' raise 'PFW: Did not get master_socket' unless master_socket connection = connect_to_master(master_socket) worker(connection) rescue => e Chore.logger.error "PFW: Shutting down #{e.} #{e.backtrace}" raise e end |