lib/job-iteration/throttle_enumerator.rb in job-iteration-1.3.0 vs lib/job-iteration/throttle_enumerator.rb in job-iteration-1.3.1

- old
+ new

@@ -26,17 +26,17 @@ @backoff = backoff end def to_enum Enumerator.new(-> { @enum.size }) do |yielder| - @enum.each do |*val| + loop do if should_throttle? ActiveSupport::Notifications.instrument("throttled.iteration", job_class: @job.class.name) @job.retry_job(wait: @backoff) throw(:abort, :skip_complete_callbacks) end - yielder.yield(*val) + yielder.yield(*@enum.next_values) end end end def should_throttle?