diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-24 00:09:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-24 00:09:55 +0300 |
commit | 4e175ca905e0c6bdcf83f78fcffd1f5bc8767f82 (patch) | |
tree | 7285e810a23238b2eba789419554cd86c9d968f3 /app/workers/merge_requests/mergeability_check_batch_worker.rb | |
parent | 3ca896b640def57a58485def308748b2fccbd0bb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers/merge_requests/mergeability_check_batch_worker.rb')
-rw-r--r-- | app/workers/merge_requests/mergeability_check_batch_worker.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/app/workers/merge_requests/mergeability_check_batch_worker.rb b/app/workers/merge_requests/mergeability_check_batch_worker.rb new file mode 100644 index 00000000000..cbe34ac3790 --- /dev/null +++ b/app/workers/merge_requests/mergeability_check_batch_worker.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module MergeRequests + class MergeabilityCheckBatchWorker + include ApplicationWorker + + data_consistency :sticky + + sidekiq_options retry: 3 + + feature_category :code_review_workflow + idempotent! + + def logger + @logger ||= Sidekiq.logger + end + + def perform(merge_request_ids) + merge_requests = MergeRequest.id_in(merge_request_ids) + + merge_requests.each do |merge_request| + result = merge_request.check_mergeability + + next unless result&.error? + + logger.error( + worker: self.class.name, + message: "Failed to check mergeability of merge request: #{result.message}", + merge_request_id: merge_request.id + ) + end + end + end +end |