Commit b04e2489 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'hotpatch-mirror-available-capacity-going-below-zero' into 'master'

Reset available mirror capacity to 0 when it falls below 0

See merge request !2409
parents 6b2a73a1 787a3a6e
...@@ -28,9 +28,15 @@ module Gitlab ...@@ -28,9 +28,15 @@ module Gitlab
end end
def available_capacity def available_capacity
current_capacity = Gitlab::Redis::SharedState.with { |redis| redis.scard(PULL_CAPACITY_KEY) } current_capacity = Gitlab::Redis::SharedState.with { |redis| redis.scard(PULL_CAPACITY_KEY) }.to_i
max_capacity - current_capacity.to_i available = max_capacity - current_capacity
if available < 0
Rails.logger.info("Mirror available capacity is below 0: #{available}")
available = 0
end
available
end end
def increment_capacity(project_id) def increment_capacity(project_id)
......
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