2018-06-27 07:23:28 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 18:09:10 +00:00
|
|
|
class UpdateMergeRequestsWorker # rubocop:disable Scalability/IdempotentWorker
|
2017-11-28 16:08:30 +00:00
|
|
|
include ApplicationWorker
|
2016-10-10 07:40:14 +00:00
|
|
|
|
2021-07-21 12:09:35 +00:00
|
|
|
data_consistency :always
|
|
|
|
|
2021-04-30 18:10:09 +00:00
|
|
|
sidekiq_options retry: 3
|
|
|
|
|
2020-12-02 18:09:35 +00:00
|
|
|
feature_category :code_review
|
2020-03-02 18:07:42 +00:00
|
|
|
urgency :high
|
2019-10-30 15:14:17 +00:00
|
|
|
worker_resource_boundary :cpu
|
2020-01-24 18:09:00 +00:00
|
|
|
weight 3
|
2020-06-12 12:08:56 +00:00
|
|
|
loggable_arguments 2, 3, 4
|
2019-10-18 11:11:44 +00:00
|
|
|
|
2022-05-23 18:08:14 +00:00
|
|
|
def perform(project_id, user_id, oldrev, newrev, ref, params = {})
|
2021-11-10 15:13:21 +00:00
|
|
|
project = Project.find_by_id(project_id)
|
2016-10-10 07:40:14 +00:00
|
|
|
return unless project
|
|
|
|
|
2021-11-10 15:13:21 +00:00
|
|
|
user = User.find_by_id(user_id)
|
2016-10-10 07:40:14 +00:00
|
|
|
return unless user
|
|
|
|
|
2022-05-23 18:08:14 +00:00
|
|
|
push_options = params.with_indifferent_access[:push_options]
|
|
|
|
|
|
|
|
MergeRequests::RefreshService
|
|
|
|
.new(project: project, current_user: user, params: { push_options: push_options })
|
|
|
|
.execute(oldrev, newrev, ref)
|
2016-10-10 07:40:14 +00:00
|
|
|
end
|
|
|
|
end
|