Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/activerecord/delay_touching.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -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
Expand Down