Commit bb7fd811 authored by Stan Hu's avatar Stan Hu

Merge branch '209160-fix-sidekiq-failure' into 'master'

Fix CodeReviewMetrics worker failure with kwargs

Closes #209160

See merge request gitlab-org/gitlab!26647
parents 695f5206 71af5b0c
......@@ -8,12 +8,12 @@ module Analytics
idempotent!
def perform(operation, merge_request_id, **execute_args)
def perform(operation, merge_request_id, execute_kwargs = {})
::MergeRequest.find_by_id(merge_request_id).try do |merge_request|
break unless merge_request.project.feature_available?(:code_review_analytics)
operation_klass = operation.constantize
operation_klass.new(merge_request).execute(**execute_args)
operation_klass.new(merge_request).execute(**execute_kwargs.deep_symbolize_keys)
end
end
end
......
......@@ -16,9 +16,9 @@ module Analytics
end
end
def execute_async(*args)
def execute_async(**kwargs)
merge_requests.each do |mr|
CodeReviewMetricsWorker.perform_async(self.class.name, mr.id, *args)
CodeReviewMetricsWorker.perform_async(self.class.name, mr.id, **kwargs)
end
end
......
......@@ -98,7 +98,7 @@ describe MergeRequests::ApprovalService do
it 'schedules RefreshApprovalsData' do
expect(Analytics::CodeReviewMetricsWorker)
.to receive(:perform_async).with('Analytics::RefreshApprovalsData', merge_request.id)
.to receive(:perform_async).with('Analytics::RefreshApprovalsData', merge_request.id, {})
service.execute(merge_request)
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