2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 13:09:10 -05:00
|
|
|
class MergeWorker # rubocop:disable Scalability/IdempotentWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2015-08-11 08:33:31 -04:00
|
|
|
|
2021-07-21 08:09:35 -04:00
|
|
|
data_consistency :always
|
|
|
|
|
2021-04-30 14:10:09 -04:00
|
|
|
sidekiq_options retry: 3
|
|
|
|
|
2019-10-18 07:11:44 -04:00
|
|
|
feature_category :source_code_management
|
2020-03-02 13:07:42 -05:00
|
|
|
urgency :high
|
2020-01-24 13:09:00 -05:00
|
|
|
weight 5
|
2020-06-12 08:08:56 -04:00
|
|
|
loggable_arguments 2
|
2021-04-26 11:10:20 -04:00
|
|
|
idempotent!
|
|
|
|
|
|
|
|
deduplicate :until_executed, including_scheduled: true
|
2019-10-18 07:11:44 -04:00
|
|
|
|
2015-08-11 08:33:31 -04:00
|
|
|
def perform(merge_request_id, current_user_id, params)
|
|
|
|
params = params.with_indifferent_access
|
2021-04-26 11:10:20 -04:00
|
|
|
|
|
|
|
begin
|
|
|
|
current_user = User.find(current_user_id)
|
|
|
|
merge_request = MergeRequest.find(merge_request_id)
|
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
return
|
|
|
|
end
|
2015-08-11 08:33:31 -04:00
|
|
|
|
2021-05-11 23:10:21 -04:00
|
|
|
MergeRequests::MergeService.new(project: merge_request.target_project, current_user: current_user, params: params)
|
2017-06-21 09:48:12 -04:00
|
|
|
.execute(merge_request)
|
2015-08-11 08:33:31 -04:00
|
|
|
end
|
|
|
|
end
|