Method: Gitlab::ReferenceCounter#decrease

Defined in:
lib/gitlab/reference_counter.rb

#decreaseBoolean

Decrease the counter

Returns:

  • (Boolean)

    whether operation was a success



50
51
52
53
54
55
56
57
58
59
# File 'lib/gitlab/reference_counter.rb', line 50

def decrease
  redis_cmd do |redis|
    current_value = redis.decr(key)
    if current_value < 0
      Gitlab::AppLogger.warn("Reference counter for #{gl_repository} decreased " \
        "when its value was less than 1. Resetting the counter.")
      redis.del(key)
    end
  end
end