diff --git a/ruby/lib/ci/queue/redis/base.rb b/ruby/lib/ci/queue/redis/base.rb index d5c4ad1a..8d0ab2a2 100644 --- a/ruby/lib/ci/queue/redis/base.rb +++ b/ruby/lib/ci/queue/redis/base.rb @@ -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)