lib/ci/queue/static.rb in ci-queue-0.45.0 vs lib/ci/queue/static.rb in ci-queue-0.46.0
- old
+ new
@@ -61,11 +61,11 @@
def created_at=(timestamp)
@created_at ||= timestamp
end
def expired?
- (@created_at.to_f TEN_MINUTES) < CI::Queue.time_now.to_f
+ (@created_at.to_f + TEN_MINUTES) < CI::Queue.time_now.to_f
end
def populated?
!!defined?(@index)
end
@@ -81,16 +81,17 @@
def remaining
@queue.size
end
def running
- 1
+ @reserved_test ? 1 : 0
end
def poll
- while !@shutdown && config.circuit_breakers.none?(&:open?) && !max_test_failed? && test = @queue.shift
- yield index.fetch(test)
+ while !@shutdown && config.circuit_breakers.none?(&:open?) && !max_test_failed? && @reserved_test = @queue.shift
+ yield index.fetch(@reserved_test)
end
+ @reserved_test = nil
end
def exhausted?
@queue.empty?
end