Commit e0c41305 authored by Gary Holtz's avatar Gary Holtz Committed by Nikola Milojevic

Pulling out logger accessor

parent d5bca724
...@@ -10,11 +10,15 @@ class MergeRequestMergeabilityCheckWorker ...@@ -10,11 +10,15 @@ class MergeRequestMergeabilityCheckWorker
feature_category :code_review feature_category :code_review
idempotent! idempotent!
def logger
Sidekiq.logger
end
def perform(merge_request_id) def perform(merge_request_id)
merge_request = MergeRequest.find_by_id(merge_request_id) merge_request = MergeRequest.find_by_id(merge_request_id)
unless merge_request 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 return
end end
...@@ -23,6 +27,6 @@ class MergeRequestMergeabilityCheckWorker ...@@ -23,6 +27,6 @@ class MergeRequestMergeabilityCheckWorker
.new(merge_request) .new(merge_request)
.execute(recheck: false, retry_lease: false) .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
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