Commit ec9f8e2841db36261deeb838c411e1d7b03eb042
1 parent
af432e5a
Exists in
master
Fixed CI for redis > 5 gem
Showing
2 changed files
with
21 additions
and
7 deletions
Show diff stats
... | ... | @@ -0,0 +1,19 @@ |
1 | +Searchkick.redis = | |
2 | + if defined?(ConnectionPool) | |
3 | + ConnectionPool.new { Redis.new } | |
4 | + else | |
5 | + Redis.new | |
6 | + end | |
7 | + | |
8 | +module RedisInstrumentation | |
9 | + def call(command, redis_config) | |
10 | + $logger.info "[redis] #{command.inspect}" | |
11 | + super | |
12 | + end | |
13 | + | |
14 | + def call_pipelined(commands, redis_config) | |
15 | + $logger.info "[redis] #{commands.inspect}" | |
16 | + super | |
17 | + end | |
18 | +end | |
19 | +RedisClient.register(RedisInstrumentation) | ... | ... |
test/test_helper.rb
... | ... | @@ -26,13 +26,6 @@ Searchkick.index_suffix = ENV["TEST_ENV_NUMBER"] # for parallel tests |
26 | 26 | |
27 | 27 | puts "Running against #{Searchkick.opensearch? ? "OpenSearch" : "Elasticsearch"} #{Searchkick.server_version}" |
28 | 28 | |
29 | -Searchkick.redis = | |
30 | - if defined?(ConnectionPool) | |
31 | - ConnectionPool.new { Redis.new(logger: $logger) } | |
32 | - else | |
33 | - Redis.new(logger: $logger) | |
34 | - end | |
35 | - | |
36 | 29 | I18n.config.enforce_available_locales = true |
37 | 30 | |
38 | 31 | ActiveJob::Base.logger = $logger |
... | ... | @@ -46,6 +39,8 @@ else |
46 | 39 | require_relative "support/activerecord" |
47 | 40 | end |
48 | 41 | |
42 | +require_relative "support/redis" | |
43 | + | |
49 | 44 | # models |
50 | 45 | Dir["#{__dir__}/models/*"].each do |file| |
51 | 46 | require file | ... | ... |