Skip to content

Commit

Permalink
Raise error when progress is negative
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisBr committed Aug 28, 2024
1 parent e4804de commit d282ebf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ruby/lib/ci/queue/redis/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,12 @@ def to_a
end.flatten.reverse.map { |k| index.fetch(k) }
end

ImplausibleProgress = Class.new(StandardError)

def progress
total - size
result = total - size
raise ImplausibleProgress, "Progress cannot be negative (#{result} (#{total} - #{size}))" if result < 0
result
end

def wait_for_master(timeout: 30)
Expand Down

0 comments on commit d282ebf

Please sign in to comment.