Class: MergeRequestMergeabilityCheckWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker
Defined in:
app/workers/merge_request_mergeability_check_worker.rb

Constant Summary

Constants included from ApplicationWorker

ApplicationWorker::LOGGING_EXTRA_KEY

Constants included from WorkerAttributes

WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES

Instance Method Summary collapse

Methods included from Gitlab::SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Instance Method Details

#perform(merge_request_id) ⇒ Object


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/workers/merge_request_mergeability_check_worker.rb', line 9

def perform(merge_request_id)
  merge_request = MergeRequest.find_by_id(merge_request_id)

  unless merge_request
    logger.error("Failed to find merge request with ID: #{merge_request_id}")
    return
  end

  result =
    ::MergeRequests::MergeabilityCheckService
      .new(merge_request)
      .execute(recheck: false, retry_lease: false)

  logger.error("Failed to check mergeability of merge request (#{merge_request_id}): #{result.message}") if result.error?
end