Merge branch 'fix-services' into 'master'

Fix async services execution broken in 7.6

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/920

See merge request !1360
This commit is contained in:
Dmitriy Zaporozhets 2014-12-29 16:31:49 +00:00
commit e0459da2a6
5 changed files with 13 additions and 11 deletions

View file

@ -1,2 +1,2 @@
web: bundle exec unicorn_rails -p ${PORT:="3000"} -E ${RAILS_ENV:="development"} -c ${UNICORN_CONFIG:="config/unicorn.rb"}
worker: bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,common,default,gitlab_shell
worker: bundle exec sidekiq -q post_receive -q mailer -q system_hook -q project_web_hook -q gitlab_shell -q common -q default

View file

@ -48,7 +48,7 @@ class WebHook < ActiveRecord::Base
verify: false,
basic_auth: auth)
end
rescue SocketError, Errno::ECONNREFUSED => e
rescue SocketError, Errno::ECONNREFUSED, Net::OpenTimeout => e
logger.error("WebHook Error => #{e}")
false
end

View file

@ -1,6 +1,14 @@
require 'slack-notifier'
class SlackMessage
attr_reader :after
attr_reader :before
attr_reader :commits
attr_reader :project_name
attr_reader :project_url
attr_reader :ref
attr_reader :username
def initialize(params)
@after = params.fetch(:after)
@before = params.fetch(:before)
@ -23,14 +31,6 @@ class SlackMessage
private
attr_reader :after
attr_reader :before
attr_reader :commits
attr_reader :project_name
attr_reader :project_url
attr_reader :ref
attr_reader :username
def message
if new_branch?
new_branch_message

View file

@ -4,6 +4,7 @@ class ProjectServiceWorker
sidekiq_options queue: :project_web_hook
def perform(hook_id, data)
data = data.with_indifferent_access
Service.find(hook_id).execute(data)
end
end

View file

@ -4,6 +4,7 @@ class ProjectWebHookWorker
sidekiq_options queue: :project_web_hook
def perform(hook_id, data)
WebHook.find(hook_id).execute data
data = data.with_indifferent_access
WebHook.find(hook_id).execute(data)
end
end