diff --git a/config/resque.yml.example b/config/resque.yml.example index 753c3308aa5d6d987923ab83ae91462f3c8b14c5..20a1c07690f71c8989297099c20a9dad3c2820ee 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: @@ -18,17 +18,17 @@ production: ## # Redis + Sentinel (for HA) # - # Please read instructions carefully before using it as you may loose data: + # Please read instructions carefully before using it as you may lose data: # http://redis.io/topics/sentinel # # You must specify a list of a few sentinels that will handle client connection # please read here for more information: https://github.com/redis/redis-rb#sentinel-support ## - #url: redis://master:6379 - # sentinels: - # - - # host: slave1 - # port: 26379 # point to sentinel, not to redis port - # - - # host: slave2 - # port: 26379 # point to sentinel, not to redis port + # url: redis://master:6379 + # sentinels: + # - + # host: slave1 + # port: 26379 # point to sentinel, not to redis port + # - + # host: slave2 + # port: 26379 # point to sentinel, not to redis port diff --git a/lib/gitlab/mail_room.rb b/lib/gitlab/mail_room.rb index b49cf1c633b873994775c3c94fccfca53a5f8c8b..1f68e09fa2b7acb17fedf01bc69863012b53aa32 100644 --- a/lib/gitlab/mail_room.rb +++ b/lib/gitlab/mail_room.rb @@ -4,7 +4,6 @@ require_relative 'redis' unless defined?(Gitlab::Redis) module Gitlab module MailRoom - class << self def enabled? config[:enabled] && config[:address] diff --git a/lib/gitlab/redis.rb b/lib/gitlab/redis.rb index 70e333eb29f2b87affc5b8aadb1f874c9ada14d1..17ac15a01dd40b7d97e434d213d10d689536cdd3 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