Commit 787a3a6e authored by Tiago Botelho's avatar Tiago Botelho

If available capacity is below 0 it defaults to 0

parent d16c3015
...@@ -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