Skip to content

Commit

Permalink
standardrb --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-Yorkley committed Mar 23, 2024
1 parent c704d41 commit 2924ee0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/stimulus_reflex/instrumentation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ def self.track(reflex)
events = []

time = Benchmark.realtime do
ActiveSupport::Notifications.subscribed(Proc.new{ |event| events << event }, /^sql.active_record|^render/) do
ActiveSupport::Notifications.subscribed(proc { |event| events << event }, /^sql.active_record|^render/) do
yield
end
end

sql, views = events.partition { |e| e.name.match?(/^sql/) }

reflex.logger.info "Processed #{reflex.class.name}##{reflex.method_name} in #{(time * 1000).round(1)}ms " +
"(Views: #{views.sum(&:duration).round(1)}ms | " +
"ActiveRecord: #{sql.sum(&:duration).round(1)}ms | " +
"Allocations: #{events.sum(&:allocations)}) \n"
reflex.logger.info "Processed #{reflex.class.name}##{reflex.method_name} in #{(time * 1000).round(1)}ms " \
"(Views: #{views.sum(&:duration).round(1)}ms | " \
"ActiveRecord: #{sql.sum(&:duration).round(1)}ms | " \
"Allocations: #{events.sum(&:allocations)}) \n"
end
end
end

0 comments on commit 2924ee0

Please sign in to comment.