I need to implement a feature that lets resque jobs timeout if they are not processed within a certain time.
So lets say a job is created but can’t be processed within one hour because the queue is too long and/or there is not enough workers working them off.
I wan’t the job to be deleted in such a case…whats the best way to do that? Maybe there is a config parameter I’m overseeing or a 3rd party gem?
Thanks
I don’t know if there’s a way to do this in Resque by default, but it wouldn’t be hard to do yourself.
In your job do something like this:
And to enqueue jobs, do: Resque.enqueue(MyJobClass, object.id, DateTime.now). The first line will automatically dump the job and prevent it from being performed if it was queued longer than an hour ago.