class Resque::Worker

Public Instance Methods

dead?() click to toggle source
# File lib/resque/heartbeat.rb, line 37
def dead?
  return heart.dead?
end
heart() click to toggle source
# File lib/resque/heartbeat.rb, line 25
def heart
  @heart ||= Heart.new(self)
end
is_me?() click to toggle source
# File lib/resque/heartbeat.rb, line 12
def is_me?
  pieces = id.split(':')
  (pieces[0].casecmp(hostname)==0) && (pieces[1].to_i == Process.pid)
end
prune_if_dead() click to toggle source
# File lib/resque/heartbeat.rb, line 41
def prune_if_dead
  return nil unless dead?

  Resque.logger.info "Pruning worker '#{remote_hostname}' from resque"
  unregister_worker
end
remote_hostname() click to toggle source
# File lib/resque/heartbeat.rb, line 29
def remote_hostname
  @remote_hostname ||= id.split(':').first
end
remote_pid() click to toggle source
# File lib/resque/heartbeat.rb, line 33
def remote_pid
  @remote_pid ||= id.split(':')[1]
end
startup()
Also aliased as: startup_without_heartbeat
startup_with_heartbeat() click to toggle source
# File lib/resque/heartbeat.rb, line 6
def startup_with_heartbeat
  startup_without_heartbeat
  heart.run
end
Also aliased as: startup
startup_without_heartbeat()
Alias for: startup
unregister_worker(*args)
unregister_worker_with_heartbeat(*args) click to toggle source
# File lib/resque/heartbeat.rb, line 18
def unregister_worker_with_heartbeat(*args)
  to_stop = is_me? ? heart : Heart.new(self)
  to_stop.stop
  unregister_worker_without_heartbeat(*args)
end
Also aliased as: unregister_worker
unregister_worker_without_heartbeat(*args)
Alias for: unregister_worker