Commit 39457e88 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Make code around final build state update more readable

parent d9ad1e4d
......@@ -28,7 +28,7 @@ module Ci
private
def accept_build_state!
if ACCEPT_TIMEOUT.ago > ensure_pending_state.created_at
if Time.current - ensure_pending_state.created_at > ACCEPT_TIMEOUT
metrics.increment_trace_operation(operation: :discarded)
return update_build_state!
......@@ -116,7 +116,7 @@ module Ci
failure_reason: params.dig(:failure_reason)
)
rescue ActiveRecord::RecordNotFound
metrics.increment_trace_operation(operation: :flaky)
metrics.increment_trace_operation(operation: :conflict)
build.pending_state
end
......
......@@ -202,12 +202,12 @@ RSpec.describe Ci::UpdateBuildStateService do
expect(result.status).to eq 200
end
it 'increments flaky trace metric' do
it 'increments conflict trace metric' do
subject.execute
expect(metrics)
.to have_received(:increment_trace_operation)
.with(operation: :flaky)
.with(operation: :conflict)
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