From 9c13ff90af5760f8a471b2d7daae44c121bb9239 Mon Sep 17 00:00:00 2001 From: Sander Verdonschot Date: Thu, 8 Feb 2024 10:39:05 -0500 Subject: [PATCH] Don't memoize interruption adapter Some tests rely on changing the interruption adapter mid-execution to test specific behaviour. We shouldn't break that with this feature. --- lib/job-iteration/iteration.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/job-iteration/iteration.rb b/lib/job-iteration/iteration.rb index 731fddf3..49a92db9 100644 --- a/lib/job-iteration/iteration.rb +++ b/lib/job-iteration/iteration.rb @@ -75,10 +75,6 @@ def around_iterate(&blk) set_callback(:iterate, :around, &blk) end - def interruption_adapter - JobIteration.interruption_adapter || JobIteration::InterruptionAdapters.lookup(queue_adapter_name) - end - private def ban_perform_definition @@ -93,7 +89,6 @@ def initialize(*arguments) self.times_interrupted = 0 self.total_time = 0.0 assert_implements_methods! - @interruption_adapter = self.class.interruption_adapter end ruby2_keywords(:initialize) if respond_to?(:ruby2_keywords, true) @@ -125,8 +120,9 @@ def retry_job(*, **) private - # @api private - attr_reader :interruption_adapter + def interruption_adapter # @private + JobIteration.interruption_adapter || JobIteration::InterruptionAdapters.lookup(self.class.queue_adapter_name) + end def enumerator_builder JobIteration.enumerator_builder.new(self)