Closed tdeo closed 8 years ago
I never really thought about how this would interact with inheritance, but this kind of thing normally involves some horrible workarounds. The issue here is that, if we have:
class AJob < ActiveJob::Base
include ActiveJob::Retry
constant_retry ...
end
class BJob < AJob; end
class CJob < AJob; end
then BJob.new.class == BJob
, when the retry settings live on AJob
. I know it is possible to set up a hook so that when BJob
inherits from AJob
it would copy the necessary class variables over, but can't remember exactly how... I'm no longer actively working on this gem, but PRs are very welcome if you have time! This PR on gocardless/statesman implements this feature.
+1
ActiveJob::Retry
, unless they do something like include ActiveJob::Retry.new(strategy: :constant, limit: 1)
. @tdeo /@charlesdg - I'd be very grateful if you could check that this fix does work for you!That indeed fixes the issue for me. Thanks
Awesome! I'll get it on RubyGems in a minute...
Released in 0.6.1
Hi,
I just came across a pretty odd issue If I have class inheritance in between my jobs. Let's say I have 2 job classes that are pretty similar, but that I want to run on different queues for priority reasons, I'll make a generic class from which both inherit, and override the queue_as method.
However, if I implement a constant_retry in the mother class, to have it in only one place, I receive those exceptions instead of the retries:
Checking manually, the backoff strategy is indeed not available in the child classes. Any idea how we could inherit retry strategy from the mother class ?