Commit 88ca733b2fb5f375c0bd7ef9f275720f25e2f8bc
1 parent
5af9c5c2
Exists in
master
and in
19 other branches
Fixed notifications [skip ci]
Showing
2 changed files
with
19 additions
and
7 deletions
Show diff stats
lib/searchkick/logging.rb
@@ -51,8 +51,12 @@ module Searchkick | @@ -51,8 +51,12 @@ module Searchkick | ||
51 | name: "#{records.first.searchkick_klass.name} Import", | 51 | name: "#{records.first.searchkick_klass.name} Import", |
52 | count: records.size | 52 | count: records.size |
53 | } | 53 | } |
54 | - ActiveSupport::Notifications.instrument("request.searchkick", event) do | ||
55 | - super(records) | 54 | + if Searchkick.callbacks_value == :bulk |
55 | + super | ||
56 | + else | ||
57 | + ActiveSupport::Notifications.instrument("request.searchkick", event) do | ||
58 | + super(records) | ||
59 | + end | ||
56 | end | 60 | end |
57 | end | 61 | end |
58 | end | 62 | end |
@@ -63,8 +67,12 @@ module Searchkick | @@ -63,8 +67,12 @@ module Searchkick | ||
63 | name: "#{records.first.searchkick_klass.name} Update", | 67 | name: "#{records.first.searchkick_klass.name} Update", |
64 | count: records.size | 68 | count: records.size |
65 | } | 69 | } |
66 | - ActiveSupport::Notifications.instrument("request.searchkick", event) do | ||
67 | - super(records, *args) | 70 | + if Searchkick.callbacks_value == :bulk |
71 | + super | ||
72 | + else | ||
73 | + ActiveSupport::Notifications.instrument("request.searchkick", event) do | ||
74 | + super(records, *args) | ||
75 | + end | ||
68 | end | 76 | end |
69 | end | 77 | end |
70 | end | 78 | end |
@@ -75,8 +83,12 @@ module Searchkick | @@ -75,8 +83,12 @@ module Searchkick | ||
75 | name: "#{records.first.searchkick_klass.name} Delete", | 83 | name: "#{records.first.searchkick_klass.name} Delete", |
76 | count: records.size | 84 | count: records.size |
77 | } | 85 | } |
78 | - ActiveSupport::Notifications.instrument("request.searchkick", event) do | ||
79 | - super(records) | 86 | + if Searchkick.callbacks_value == :bulk |
87 | + super | ||
88 | + else | ||
89 | + ActiveSupport::Notifications.instrument("request.searchkick", event) do | ||
90 | + super(records) | ||
91 | + end | ||
80 | end | 92 | end |
81 | end | 93 | end |
82 | end | 94 | end |
test/test_helper.rb
@@ -25,7 +25,7 @@ if defined?(ActiveJob) | @@ -25,7 +25,7 @@ if defined?(ActiveJob) | ||
25 | ActiveJob::Base.queue_adapter = :inline | 25 | ActiveJob::Base.queue_adapter = :inline |
26 | end | 26 | end |
27 | 27 | ||
28 | -ActiveSupport::LogSubscriber.logger = Logger.new(STDOUT) if ENV["NOTIFICATIONS"] | 28 | +ActiveSupport::LogSubscriber.logger = ActiveSupport::Logger.new(STDOUT) if ENV["NOTIFICATIONS"] |
29 | 29 | ||
30 | def elasticsearch_below50? | 30 | def elasticsearch_below50? |
31 | Searchkick.server_below?("5.0.0-alpha1") | 31 | Searchkick.server_below?("5.0.0-alpha1") |