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, #monitor, #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?, #notify_ready, #outdated?, #pending?, #promote, #promote!, #promoted!, #ready=, #ready?, #reset, #soft_kill, #spawn_service, #spawn_worker, #start_promotion, #to_io, #update, #update_deadline, #worker?

Constructor Details

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

Returns a new instance of Service.



281
282
283
# File 'lib/pitchfork/worker.rb', line 281

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

Instance Method Details

#register_to_monitor(control_socket) ⇒ Object



289
290
291
292
293
294
# File 'lib/pitchfork/worker.rb', line 289

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

#service?Boolean

Returns:

  • (Boolean)


285
286
287
# File 'lib/pitchfork/worker.rb', line 285

def service?
  true
end

#to_logObject



296
297
298
# File 'lib/pitchfork/worker.rb', line 296

def to_log
  pid ? "service gen=#{generation} pid=#{pid}" : "service gen=#{generation}"
end