Async::Job::Processor::Redis SourceAsyncJobProcessorRedisServer

class Server

Definitions

def dequeue(parent)

Dequeue a job from the ready list and process it.

If the job fails for any reason, it will be retried.

If you do not desire this behavior, you should catch exceptions in the delegate.

Implementation

def dequeue(parent)
	_id = @processing_list.fetch
	
	parent.async do
		id = _id; _id = nil
		
		job = @coder.load(@job_store.get(id))
		@delegate.call(job)
		@processing_list.complete(id)
	rescue => error
		Console::Event::Failure.for(error).emit(self, "Job failed with error!", id: id)
		@processing_list.retry(id)
	end
ensure
	@processing_list.retry(_id) if _id
end