Class: Pitchfork::Service

Inherits:
Worker
  • Object
show all
Defined in:
lib/pitchfork/worker.rb

Constant Summary

Constants inherited from Worker

Worker::EXIT_SIGNALS

Instance Attribute Summary

Attributes inherited from Worker

#generation, #master, #nr, #pid, #requests_count

Instance Method Summary collapse

Methods inherited from Worker

#==, #accept_nonblock, #after_fork_in_child, #close, #create_socketpair!, #deadline, #deadline=, #exiting?, #fake_sig, #finish_promotion, #hard_kill, #increment_requests_count, #mold?, #outdated?, #pending?, #promote, #promote!, #promoted!, #reset, #soft_kill, #spawn_service, #spawn_worker, #start_promotion, #to_io, #update, #update_deadline

Constructor Details

#initialize(pid: nil, generation: 0) ⇒ Service

Returns a new instance of Service.



245
246
247
# File 'lib/pitchfork/worker.rb', line 245

def initialize(pid: nil, generation: 0)
  super(nil, pid: pid, generation: generation)
end

Instance Method Details

#register_to_master(control_socket) ⇒ Object



253
254
255
256
257
258
# File 'lib/pitchfork/worker.rb', line 253

def register_to_master(control_socket)
  create_socketpair!
  message = Message::ServiceSpawned.new(@pid, generation, @master)
  control_socket.sendmsg(message)
  @master.close
end

#service?Boolean

Returns:

  • (Boolean)


249
250
251
# File 'lib/pitchfork/worker.rb', line 249

def service?
  true
end