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 | 51 | name: "#{records.first.searchkick_klass.name} Import", |
52 | 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 | 60 | end |
57 | 61 | end |
58 | 62 | end |
... | ... | @@ -63,8 +67,12 @@ module Searchkick |
63 | 67 | name: "#{records.first.searchkick_klass.name} Update", |
64 | 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 | 76 | end |
69 | 77 | end |
70 | 78 | end |
... | ... | @@ -75,8 +83,12 @@ module Searchkick |
75 | 83 | name: "#{records.first.searchkick_klass.name} Delete", |
76 | 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 | 92 | end |
81 | 93 | end |
82 | 94 | end | ... | ... |
test/test_helper.rb
... | ... | @@ -25,7 +25,7 @@ if defined?(ActiveJob) |
25 | 25 | ActiveJob::Base.queue_adapter = :inline |
26 | 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 | 30 | def elasticsearch_below50? |
31 | 31 | Searchkick.server_below?("5.0.0-alpha1") | ... | ... |