Skip to content

Commit

Permalink
Don't memoize interruption adapter
Browse files Browse the repository at this point in the history
Some tests rely on changing the interruption adapter mid-execution to test specific behaviour. We shouldn't break that with this feature.
  • Loading branch information
Mangara committed Feb 8, 2024
1 parent a4da9c1 commit 9c13ff9
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/job-iteration/iteration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9c13ff9

Please sign in to comment.