Skip to content

Commit d548609

Browse files
committed
Merge branch 'refactor_redis' of /home/git/repositories/gitlab/gitlab-shell
2 parents e680254 + 6c8c9ff commit d548609

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/gitlab_config.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ def redis_command
4848
if redis.empty?
4949
# Default to old method of connecting to redis
5050
# for users that haven't updated their configuration
51-
"env -i redis-cli"
51+
%W(env -i redis-cli)
5252
else
5353
if redis.has_key?("socket")
54-
"#{redis['bin']} -s #{redis['socket']}"
54+
%W(#{redis['bin']} -s #{redis['socket']})
5555
else
56-
"#{redis['bin']} -h #{redis['host']} -p #{redis['port']}"
56+
%W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']})
5757
end
5858
end
5959
end

lib/gitlab_update.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require_relative 'gitlab_init'
22
require_relative 'gitlab_net'
3+
require 'json'
34

45
class GitlabUpdate
56
attr_reader :config
@@ -53,7 +54,8 @@ def ssh?
5354
end
5455

5556
def update_redis
56-
command = "#{config.redis_command} rpush '#{config.redis_namespace}:queue:post_receive' '{\"class\":\"PostReceive\",\"args\":[\"#{@repo_path}\",\"#{@oldrev}\",\"#{@newrev}\",\"#{@refname}\",\"#{@key_id}\"]}' > /dev/null 2>&1"
57-
system(command)
57+
queue = "#{config.redis_namespace}:queue:post_receive"
58+
msg = JSON.dump({'class' => 'PostReceive', 'args' => [@repo_path, @oldrev, @newrev, @refname, @key_id]})
59+
system(*config.redis_command, 'rpush', queue, msg, err: '/dev/null', out: '/dev/null')
5860
end
5961
end

0 commit comments

Comments
 (0)