summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Mazetto <gabriel@gitlab.com>2016-07-12 17:10:03 +0200
committerGabriel Mazetto <gabriel@gitlab.com>2016-07-13 00:23:16 +0200
commitc53f968c63747605a2ee6617a37a14d039832a87 (patch)
treeff73ae7194572113b2fff5e21df8e6f73f545954
parent67f668e48fe87c6b12b1aa25f5b2c01fa6c508f4 (diff)
downloadgitlab-ce-c53f968c63747605a2ee6617a37a14d039832a87.tar.gz
Few minor fixes to Redis params order and commented out sentinel config
in resque.yml.example
-rw-r--r--config/resque.yml.example14
-rw-r--r--lib/gitlab/redis.rb13
2 files changed, 14 insertions, 13 deletions
diff --git a/config/resque.yml.example b/config/resque.yml.example
index 753c3308aa5..7b03132ff9e 100644
--- a/config/resque.yml.example
+++ b/config/resque.yml.example
@@ -3,13 +3,13 @@
#
development:
url: redis://localhost:6379
- sentinels:
- -
- host: localhost
- port: 26380 # point to sentinel, not to redis port
- -
- host: slave2
- port: 26381 # point to sentinel, not to redis port
+# sentinels:
+# -
+# host: localhost
+# port: 26380 # point to sentinel, not to redis port
+# -
+# host: slave2
+# port: 26381 # point to sentinel, not to redis port
test:
url: redis://localhost:6379
production:
diff --git a/lib/gitlab/redis.rb b/lib/gitlab/redis.rb
index 70e333eb29f..17ac15a01dd 100644
--- a/lib/gitlab/redis.rb
+++ b/lib/gitlab/redis.rb
@@ -53,18 +53,19 @@ module Gitlab
def redis_store_options
config = raw_config_hash
+ redis_url = config.delete(:url)
+ redis_uri = URI.parse(redis_url)
- redis_uri = URI.parse(config[:url])
if redis_uri.scheme == 'unix'
# Redis::Store does not handle Unix sockets well, so let's do it for them
config[:path] = redis_uri.path
+ config
else
- redis_hash = ::Redis::Store::Factory.extract_host_options_from_uri(config[:url])
- config.merge!(redis_hash)
+ redis_hash = ::Redis::Store::Factory.extract_host_options_from_uri(redis_url)
+ # order is important here, sentinels must be after the connection keys.
+ # {url: ..., port: ..., sentinels: [...]}
+ redis_hash.merge(config)
end
-
- config.delete(:url)
- config
end
def raw_config_hash