Commit 04af5ba2883521c1c64093a015c5f7e46aaeb41a

Authored by Andrew Kane
1 parent 383550e7

Use one method for simplicity

Showing 1 changed file with 4 additions and 6 deletions   Show diff stats
lib/searchkick/logging.rb
... ... @@ -20,7 +20,7 @@ module Searchkick
20 20 name: "#{record.searchkick_klass.name} Store",
21 21 id: search_id(record)
22 22 }
23   - ActiveSupport::Notifications.instrument("store.searchkick", event) do
  23 + ActiveSupport::Notifications.instrument("request.searchkick", event) do
24 24 store_without_instrumentation(record)
25 25 end
26 26 end
... ... @@ -31,7 +31,7 @@ module Searchkick
31 31 name: "#{record.searchkick_klass.name} Remove",
32 32 id: search_id(record)
33 33 }
34   - ActiveSupport::Notifications.instrument("remove.searchkick", event) do
  34 + ActiveSupport::Notifications.instrument("request.searchkick", event) do
35 35 remove_without_instrumentation(record)
36 36 end
37 37 end
... ... @@ -42,7 +42,7 @@ module Searchkick
42 42 name: "#{records.first.searchkick_klass.name} Import",
43 43 count: records.size
44 44 }
45   - ActiveSupport::Notifications.instrument("import.searchkick", event) do
  45 + ActiveSupport::Notifications.instrument("request.searchkick", event) do
46 46 import_without_instrumentation(records)
47 47 end
48 48 end
... ... @@ -78,7 +78,7 @@ module Searchkick
78 78 debug " #{color(name, YELLOW, true)} curl #{host[:protocol]}://#{host[:host]}:#{host[:port]}/#{CGI.escape(index)}#{type ? "/#{type.map{|t| CGI.escape(t) }.join(",")}" : ""}/_search?pretty -d '#{payload[:query][:body].to_json}'"
79 79 end
80 80  
81   - def store(event)
  81 + def request(event)
82 82 self.class.runtime += event.duration
83 83 return unless logger.debug?
84 84  
... ... @@ -87,8 +87,6 @@ module Searchkick
87 87  
88 88 debug " #{color(name, YELLOW, true)} #{payload.except(:name).to_json}"
89 89 end
90   - alias_method :remove, :store
91   - alias_method :import, :store
92 90 end
93 91  
94 92 # https://github.com/rails/rails/blob/master/activerecord/lib/active_record/railties/controller_runtime.rb
... ...