Commit 4f4b77d3 authored by Nikola Milojevic's avatar Nikola Milojevic

Merge branch...

Merge branch '337644-follow-up-from-use-structured-logging-for-mergerequestmergeabilitycheckworker' into 'master'

Make an accessor for logging in MergeRequestMergeabilityCheckWorker

See merge request gitlab-org/gitlab!67521
parents bdefcb44 d25edf8d
......@@ -10,11 +10,15 @@ class MergeRequestMergeabilityCheckWorker
feature_category :code_review
idempotent!
def logger
@logger ||= Sidekiq.logger
end
def perform(merge_request_id)
merge_request = MergeRequest.find_by_id(merge_request_id)
unless merge_request
Sidekiq.logger.error(worker: self.class.name, message: "Failed to find merge request", merge_request_id: merge_request_id)
logger.error(worker: self.class.name, message: "Failed to find merge request", merge_request_id: merge_request_id)
return
end
......@@ -23,6 +27,6 @@ class MergeRequestMergeabilityCheckWorker
.new(merge_request)
.execute(recheck: false, retry_lease: false)
Sidekiq.logger.error(worker: self.class.name, message: "Failed to check mergeability of merge request: #{result.message}", merge_request_id: merge_request_id) if result.error?
logger.error(worker: self.class.name, message: "Failed to check mergeability of merge request: #{result.message}", merge_request_id: merge_request_id) if result.error?
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment