Reputation: 83299
The resque-retry gem's README discusses changing the failure backend implementation when implementing.
MultipleWithRetrySuppression
is a multiple failure backend, with retry suppression.Here's an example, using the Redis failure backend:
require 'resque-retry' require 'resque/failure/redis' # require your jobs & application code. Resque::Failure::MultipleWithRetrySuppression.classes = [Resque::Failure::Redis] Resque::Failure.backend = Resque::Failure::MultipleWithRetrySuppression
If a job fails, but can and will retry, the failure details wont be logged in the Redis failed queue (visible via resque-web).
If the job fails, but can't or won't retry, the failure will be logged in the Redis failed queue, like a normal failure (without retry) would.
I'm not sure where in my Rails app that code should go. Should I just place it into any random initializer file, e.g. config/initializers/resque.rb
? Or is there some other place in my app where it should go? The documentation is not clear.
Upvotes: 5
Views: 1298
Reputation: 83299
Looks like an initializer is the best bet. Accepting this as the best answer unless someone comes along with a better suggestion.
Upvotes: 4