lib/resque/worker.rb
# Unregisters ourself as a worker. Useful when shutting down.
Unregisters ourself as a worker. Useful when shutting down.
Unregisters ourself as a worker . Useful when shutting down .
def unregister_worker
      if (hash = processing) && !hash.empty?
        job = Job.new(hash['queue'], hash['payload'])
        job.worker = self
        job.fail(DirtyExit.new)
      end
      with_retries do
        redis.pipelined do
          redis.srem(:workers, self)
          redis.del("worker:#{self}")
          redis.del("worker:#{self}:queues")
        end
      end
    end
def unregister_worker if ( hash = processing ) && ! hash . empty? job = Job . new ( hash [ 'queue' ] , hash [ 'payload' ] ) job . worker = self job . fail ( DirtyExit . new ) end with_retries do redis . pipelined do redis . srem ( :workers , self ) redis . del ( "worker:#{self}" ) redis . del ( "worker:#{self}:queues" ) end end end
Unregisters ourself as a worker.
Unregisters ourself as a worker .
# If we're still processing a job, make sure it gets logged as a # failure. # Ensure the proper worker is attached to this job, even if # it's not the precise instance that died.