Merge pull request #50767 from rporrasluc/fix-db-runtime-calculation

Fix calculation of SQL runtime
This commit is contained in:
Jean Boussier 2024-01-16 17:21:05 +01:00 committed by GitHub
commit 758e6e1a22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -34,7 +34,8 @@ module ActiveRecord
end
ActiveSupport::Notifications.monotonic_subscribe("sql.active_record") do |name, start, finish, id, payload|
runtime = finish - start
runtime = (finish - start) * 1_000.0
if payload[:async]
ActiveRecord::RuntimeRegistry.async_sql_runtime += (runtime - payload[:lock_wait])
end