Commit e0459da2 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

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
parents c662b2e1 2ed9a42e
web: bundle exec unicorn_rails -p ${PORT:="3000"} -E ${RAILS_ENV:="development"} -c ${UNICORN_CONFIG:="config/unicorn.rb"} 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
...@@ -48,7 +48,7 @@ class WebHook < ActiveRecord::Base ...@@ -48,7 +48,7 @@ class WebHook < ActiveRecord::Base
verify: false, verify: false,
basic_auth: auth) basic_auth: auth)
end end
rescue SocketError, Errno::ECONNREFUSED => e rescue SocketError, Errno::ECONNREFUSED, Net::OpenTimeout => e
logger.error("WebHook Error => #{e}") logger.error("WebHook Error => #{e}")
false false
end end
......
require 'slack-notifier' require 'slack-notifier'
class SlackMessage 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) def initialize(params)
@after = params.fetch(:after) @after = params.fetch(:after)
@before = params.fetch(:before) @before = params.fetch(:before)
...@@ -23,14 +31,6 @@ class SlackMessage ...@@ -23,14 +31,6 @@ class SlackMessage
private 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 def message
if new_branch? if new_branch?
new_branch_message new_branch_message
......
...@@ -4,6 +4,7 @@ class ProjectServiceWorker ...@@ -4,6 +4,7 @@ class ProjectServiceWorker
sidekiq_options queue: :project_web_hook sidekiq_options queue: :project_web_hook
def perform(hook_id, data) def perform(hook_id, data)
data = data.with_indifferent_access
Service.find(hook_id).execute(data) Service.find(hook_id).execute(data)
end end
end end
...@@ -4,6 +4,7 @@ class ProjectWebHookWorker ...@@ -4,6 +4,7 @@ class ProjectWebHookWorker
sidekiq_options queue: :project_web_hook sidekiq_options queue: :project_web_hook
def perform(hook_id, data) def perform(hook_id, data)
WebHook.find(hook_id).execute data data = data.with_indifferent_access
WebHook.find(hook_id).execute(data)
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment