diff options
author | Gabriel Mazetto <gabriel@gitlab.com> | 2016-07-08 04:33:37 +0300 |
---|---|---|
committer | Gabriel Mazetto <gabriel@gitlab.com> | 2016-08-04 19:55:37 +0300 |
commit | 6f318795083ca3d3726bb6bf5f4dc4081cfba8bf (patch) | |
tree | 86e373d0ca88d5ef2d85e5c4f86877a762da64ff /lib/gitlab/redis.rb | |
parent | eacdb1012032136f32bb0470e6f85714eb7fca6d (diff) |
Fixed specs for Gitlab::Redis and code for Redis Sentinel support
Diffstat (limited to 'lib/gitlab/redis.rb')
-rw-r--r-- | lib/gitlab/redis.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/gitlab/redis.rb b/lib/gitlab/redis.rb index 8c277d97f1a..9c4b01bfe1a 100644 --- a/lib/gitlab/redis.rb +++ b/lib/gitlab/redis.rb @@ -19,7 +19,7 @@ module Gitlab class << self def params - @params || PARAMS_MUTEX.synchronize { @params = new.params } + PARAMS_MUTEX.synchronize { new.params } end # @deprecated Use .params instead to get sentinel support @@ -38,7 +38,7 @@ module Gitlab end def initialize(rails_env=nil) - @rails_env = rails_env || Rails.env + @rails_env = rails_env || ::Rails.env end def params @@ -55,7 +55,7 @@ module Gitlab # Redis::Store does not handle Unix sockets well, so let's do it for them config[:path] = redis_uri.path else - redis_hash = ::Redis::Store::Factory.extract_host_options_from_uri(redis_uri) + redis_hash = ::Redis::Store::Factory.extract_host_options_from_uri(config[:url]) config.merge!(redis_hash) end @@ -74,7 +74,8 @@ module Gitlab end def fetch_config - File.exists?(config_file) ? YAML.load_file(config_file)[@rails_env] : false + file = config_file + File.exist?(file) ? YAML.load_file(file)[@rails_env] : false end def config_file |