diff options
author | aiionx <aion.x@hotmail.com> | 2016-04-13 20:00:37 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-04-19 21:31:09 -0700 |
commit | 750fd3f8447c3e7a742a33f45b46b10e4d763c3e (patch) | |
tree | 18e52a25c25dd18e52c57f9aed979260702caf0e /lib | |
parent | 4a8db75d9de6ff5ce56be6c36e957e89971a2d42 (diff) | |
download | gitlab-shell-750fd3f8447c3e7a742a33f45b46b10e4d763c3e.tar.gz |
Update post receive worker so it logs a unique JID in sidekiqaiionx/gitlab-shell-aiionx-post_receive_jid
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab_post_receive.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/gitlab_post_receive.rb b/lib/gitlab_post_receive.rb index ede64f2..0fff479 100644 --- a/lib/gitlab_post_receive.rb +++ b/lib/gitlab_post_receive.rb @@ -2,14 +2,16 @@ require_relative 'gitlab_init' require_relative 'gitlab_net' require 'json' require 'base64' +require 'securerandom' class GitlabPostReceive - attr_reader :config, :repo_path, :changes + attr_reader :config, :repo_path, :changes, :jid def initialize(repo_path, actor, changes) @config = GitlabConfig.new @repo_path, @actor = repo_path.strip, actor @changes = changes + @jid = SecureRandom.hex(12) end def exec @@ -71,7 +73,7 @@ class GitlabPostReceive changes = Base64.encode64(@changes) queue = "#{config.redis_namespace}:queue:post_receive" - msg = JSON.dump({ 'class' => 'PostReceive', 'args' => [@repo_path, @actor, changes] }) + msg = JSON.dump({ 'class' => 'PostReceive', 'args' => [@repo_path, @actor, changes], 'jid' => @jid }) if system(*config.redis_command, 'rpush', queue, msg, err: '/dev/null', out: '/dev/null') return true |