Commit bae6385b authored by micael.bergeron's avatar micael.bergeron

add simple logging to UpdateMergeRequestsWorker#perform

this is to try to debug #35914
parent 9200b500
......@@ -9,6 +9,17 @@ class UpdateMergeRequestsWorker
user = User.find_by(id: user_id)
return unless user
# TODO: remove this benchmarking when we have rich logging
time = Benchmark.measure do
MergeRequests::RefreshService.new(project, user).execute(oldrev, newrev, ref)
end
log_args = ["elapsed=#{time.real}"]
method(__method__).parameters.map do |_, p|
pname = p.to_s
log_args << [pname, binding.local_variable_get(pname)].join('=')
end
Rails.logger.info("UpdateMergeRequestsWorker#perform #{log_args.join(',')}")
end
end
......@@ -23,5 +23,11 @@ describe UpdateMergeRequestsWorker do
perform
end
it 'logs performance' do
expect(Rails.logger).to receive(:info).with(a_string_matching(/\AUpdateMergeRequestsWorker#perform.*project_id=#{project.id},user_id=#{user.id},oldrev=#{oldrev},newrev=#{newrev},ref=#{ref}/))
perform
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