Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Is resque-retry compatible with Rails ActiveJob? #140
I have a bunch of jobs working perfectly fine with resque, resque-scheduler and resque-pool.
Unfortunately though I can't get resque-retry to work. I queue a thousand jobs, send a SIGHUP to resque-pool (which in turns sends a SIGTERM to the workers) and in the interface I find some of them in the failed queue and they are never ever retried (I waited a few minutes to make sure :D)
require 'resque-retry/server' require 'resque-retry' require 'resque/failure/redis' require 'rollbar' Resque.logger.level = Logger::DEBUG if Rails.env.development? Resque::Failure::MultipleWithRetrySuppression.classes = [ Resque::Failure::Redis#, Resque::Failure::Rollbar ] Resque::Failure.backend = Resque::Failure::MultipleWithRetrySuppression
require 'resque/pool/tasks' require 'resque/scheduler/tasks' task 'resque:setup' => :environment do end task 'resque:pool:setup' => :environment do # close any sockets or files in pool manager ActiveRecord::Base.connection.disconnect! # and re-open them in the resque worker parent Resque::Pool.after_prefork do |_job| ActiveRecord::Base.establish_connection end end
class DoSomethingJob < ActiveJob::Base include Rollbar::ActiveJob extend Resque::Plugins::Retry @retry_limit = 3 @retry_delay = 3 @retry_exceptions = [Resque::TermException] queue_as :default def perform(argument) ...do the stuff... end end
What happens after sending SIGHUP to the pool is that I end up with some jobs in the Resque failed queue and they all failed due to SIGTERM / Resque::TermException without ever retrying.
Could it be that ActiveJob and resque-retry do not play nice?
I'm using Rails 22.214.171.124 and the current released versions of resque, resque-pool, resque-scheduler and resque-retry
ActiveJob specifically abstracts away the underlying queue/job system, so I'm not surprised it doesn't work.
We don't have any tests for ActiveJob and I'm not familiar with it myself, that doesn't mean it resque-retry can't work with it or be adapted to.
I'd accept a PR to make it work so long as it doesn't effect vanilla Resque.
Perhaps you could do some research and report back with your findings? :)
Sent from my iPhone
Old thread, but for what it's worth, I included ActiveJob support by doing this: