Commit 75bfc7e5 authored by Stan Hu's avatar Stan Hu

Add support for Google Cloud Memorystore

This adds an optional `redis_enable_client` config option that will turn
off the CLIENT command when talking to the Sidekiq API.

Relates to https://gitlab.com/gitlab-org/omnibus-gitlab/issues/4164
parent fce00320
Pipeline #106407 passed with stage
in 35 seconds
...@@ -78,6 +78,7 @@ probes: ...@@ -78,6 +78,7 @@ probes:
- probe_dead - probe_dead
opts: opts:
redis_url: "redis://localhost:6379" redis_url: "redis://localhost:6379"
redis_enable_client: true
metrics: metrics:
multiple: true multiple: true
......
...@@ -15,12 +15,7 @@ module GitLab ...@@ -15,12 +15,7 @@ module GitLab
@metrics = metrics @metrics = metrics
Sidekiq.configure_client do |config| Sidekiq.configure_client do |config|
config.redis = { config.redis = redis_options
url: opts[:redis_url],
namespace: "resque:gitlab",
connect_timeout: 1,
reconnect_attempts: 0
}
end end
ensure_queue_job_stats_script_loaded ensure_queue_job_stats_script_loaded
...@@ -110,6 +105,24 @@ module GitLab ...@@ -110,6 +105,24 @@ module GitLab
private private
def redis_options
options = {
url: @opts[:redis_url],
namespace: "resque:gitlab",
connect_timeout: 1,
reconnect_attempts: 0
}
options[:id] = nil unless redis_enable_client?
options
end
def redis_enable_client?
return true if @opts[:redis_enable_client].nil?
@opts[:redis_enable_client]
end
def connected? def connected?
@connected ||= begin @connected ||= begin
Sidekiq.redis do |conn| Sidekiq.redis do |conn|
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment