diff --git a/lib/searchkick/logging.rb b/lib/searchkick/logging.rb index 17524ca..17e213e 100644 --- a/lib/searchkick/logging.rb +++ b/lib/searchkick/logging.rb @@ -51,8 +51,12 @@ module Searchkick name: "#{records.first.searchkick_klass.name} Import", count: records.size } - ActiveSupport::Notifications.instrument("request.searchkick", event) do - super(records) + if Searchkick.callbacks_value == :bulk + super + else + ActiveSupport::Notifications.instrument("request.searchkick", event) do + super(records) + end end end end @@ -63,8 +67,12 @@ module Searchkick name: "#{records.first.searchkick_klass.name} Update", count: records.size } - ActiveSupport::Notifications.instrument("request.searchkick", event) do - super(records, *args) + if Searchkick.callbacks_value == :bulk + super + else + ActiveSupport::Notifications.instrument("request.searchkick", event) do + super(records, *args) + end end end end @@ -75,8 +83,12 @@ module Searchkick name: "#{records.first.searchkick_klass.name} Delete", count: records.size } - ActiveSupport::Notifications.instrument("request.searchkick", event) do - super(records) + if Searchkick.callbacks_value == :bulk + super + else + ActiveSupport::Notifications.instrument("request.searchkick", event) do + super(records) + end end end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 06fbce7..dae9e9f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -25,7 +25,7 @@ if defined?(ActiveJob) ActiveJob::Base.queue_adapter = :inline end -ActiveSupport::LogSubscriber.logger = Logger.new(STDOUT) if ENV["NOTIFICATIONS"] +ActiveSupport::LogSubscriber.logger = ActiveSupport::Logger.new(STDOUT) if ENV["NOTIFICATIONS"] def elasticsearch_below50? Searchkick.server_below?("5.0.0-alpha1") -- libgit2 0.21.0