Skip to content

Commit

Permalink
Don't cache ActiveSupport::Notifications.instrumenter in AbstractAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebarrie committed Jun 21, 2023
1 parent c622a4d commit 32d55b6
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def initialize(config_or_deprecated_connection, deprecated_logger = nil, depreca
end

@owner = nil
@instrumenter = ActiveSupport::Notifications.instrumenter
@instrumenter = nil
@pool = ActiveRecord::ConnectionAdapters::NullPool.new
@idle_since = Process.clock_gettime(Process::CLOCK_MONOTONIC)
@visitor = arel_visitor
Expand Down Expand Up @@ -1126,7 +1126,8 @@ def translate_exception_class(e, sql, binds)
end

def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil, async: false, &block) # :doc:
@instrumenter.instrument(
instrumenter = @instrumenter || ActiveSupport::Notifications.instrumenter
instrumenter.instrument(
"sql.active_record",
sql: sql,
name: name,
Expand Down

0 comments on commit 32d55b6

Please sign in to comment.