2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 13:09:10 -05:00
|
|
|
class UpdateMergeRequestsWorker # rubocop:disable Scalability/IdempotentWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2016-10-10 03:40:14 -04:00
|
|
|
|
2019-10-18 07:11:44 -04:00
|
|
|
feature_category :source_code_management
|
2020-03-02 13:07:42 -05:00
|
|
|
urgency :high
|
2019-10-30 11:14:17 -04:00
|
|
|
worker_resource_boundary :cpu
|
2020-01-24 13:09:00 -05:00
|
|
|
weight 3
|
2019-10-18 07:11:44 -04:00
|
|
|
|
2017-11-14 09:22:15 -05:00
|
|
|
LOG_TIME_THRESHOLD = 90 # seconds
|
|
|
|
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2016-10-10 03:40:14 -04:00
|
|
|
def perform(project_id, user_id, oldrev, newrev, ref)
|
|
|
|
project = Project.find_by(id: project_id)
|
|
|
|
return unless project
|
|
|
|
|
|
|
|
user = User.find_by(id: user_id)
|
|
|
|
return unless user
|
|
|
|
|
2020-03-12 14:09:28 -04:00
|
|
|
MergeRequests::RefreshService.new(project, user).execute(oldrev, newrev, ref)
|
2016-10-10 03:40:14 -04:00
|
|
|
end
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2016-10-10 03:40:14 -04:00
|
|
|
end
|