lib/searchkick/logging.rb in searchkick-2.0.4 vs lib/searchkick/logging.rb in searchkick-2.1.0
- old
+ new
@@ -49,11 +49,47 @@
if records.any?
event = {
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
+ end
+ end
+ end
+ end
+
+ def bulk_update(records, *args)
+ if records.any?
+ event = {
+ name: "#{records.first.searchkick_klass.name} Update",
+ count: records.size
+ }
+ if Searchkick.callbacks_value == :bulk
+ super
+ else
+ ActiveSupport::Notifications.instrument("request.searchkick", event) do
+ super
+ end
+ end
+ end
+ end
+
+ def bulk_delete(records)
+ if records.any?
+ event = {
+ name: "#{records.first.searchkick_klass.name} Delete",
+ count: records.size
+ }
+ if Searchkick.callbacks_value == :bulk
+ super
+ else
+ ActiveSupport::Notifications.instrument("request.searchkick", event) do
+ super
+ end
end
end
end
end