diff --git a/lib/activerecord/delay_touching.rb b/lib/activerecord/delay_touching.rb index f77d33a..f17d1be 100644 --- a/lib/activerecord/delay_touching.rb +++ b/lib/activerecord/delay_touching.rb @@ -60,6 +60,8 @@ def self.call # Apply the touches that were delayed. def self.apply + n = 0 # count loops + nth = (ENV['DELAY_TOUCHING_LOG_LOOP_EVERY'] || 100).to_i begin ActiveRecord::Base.transaction do state.records_by_attrs_and_class.each do |attr, classes_and_records| @@ -68,6 +70,8 @@ def self.apply end end end + n += 1 + Rails.logger.error { "=== DelayTouch::apply: loop count: #{n}"} if n % nth == 0 end while state.more_records? ensure state.clear_records