Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions ruby/lib/ci/queue/redis/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,28 @@ def acknowledge(test_or_id)
# Accept either an object with .id or a string ID
test_key = test_or_id.respond_to?(:id) ? test_or_id.id : test_or_id
raise_on_mismatching_test(test_key)
eval_script(
:acknowledge,
keys: [key('running'), key('processed'), key('owners')],
argv: [test_key],
) == 1

max_retries = 5
retry_count = 0

begin
eval_script(
:acknowledge,
keys: [key('running'), key('processed'), key('owners')],
argv: [test_key],
) == 1
Comment on lines +155 to +159

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a log for when a test is acknowledged too?

rescue StandardError => e
retry_count += 1
if retry_count < max_retries
# Exponential backoff: 1s, 2s, ...
sleep(0.1 * (2 ** (retry_count - 1)))
retry
else
warn("Failed to acknowledge test #{test_key.inspect} after #{max_retries} retries: #{e.class} - #{e.message}. " \
"Test remains in running set and may be picked up by reserve_lost after timeout.")
raise
end
end
end

def requeue(test, offset: Redis.requeue_offset, skip_reservation_check: false)
Expand Down