From 750fd3f8447c3e7a742a33f45b46b10e4d763c3e Mon Sep 17 00:00:00 2001 From: aiionx Date: Wed, 13 Apr 2016 20:00:37 -0700 Subject: Update post receive worker so it logs a unique JID in sidekiq --- lib/gitlab_post_receive.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') 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 -- cgit v1.2.1