2021-03-11 19:13:27 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
require 'gitlab/redis'
|
|
|
|
|
|
|
|
Redis.raise_deprecations = true unless Rails.env.production?
|
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
# We set the instance variable directly to suppress warnings.
|
|
|
|
# We cannot switch to the new behavior until we change all existing `redis.exists` calls to `redis.exists?`.
|
|
|
|
# Some gems also need to be updated
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab/-/issues/340602
|
|
|
|
Redis.instance_variable_set(:@exists_returns_integer, false)
|
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
Redis::Client.prepend(Gitlab::Instrumentation::RedisInterceptor)
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
# Make sure we initialize a Redis connection pool before multi-threaded
|
|
|
|
# execution starts by
|
|
|
|
# 1. Sidekiq
|
|
|
|
# 2. Rails.cache
|
|
|
|
# 3. HTTP clients
|
2022-10-11 01:57:18 +05:30
|
|
|
Gitlab::Redis::ALL_CLASSES.each do |redis_instance|
|
|
|
|
redis_instance.with { nil }
|
|
|
|
end
|