Exception: Apartment::PoolCapacityReached

Inherits:
ApartmentError show all
Defined in:
lib/apartment/errors.rb

Overview

Raised when admitting a new tenant pool would exceed max_total_connections and no idle pool can be evicted to make room, under the :raise overflow policy. Distinct from PoolExhausted (a single pool’s connections) — this is the process-wide pool-count ceiling. See docs/designs/pool-admission-control.md.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(max_total: nil, current: nil) ⇒ PoolCapacityReached

Returns a new instance of PoolCapacityReached.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/apartment/errors.rb', line 43

def initialize(max_total: nil, current: nil)
  @max_total = max_total
  @current = current
  super(
    "Tenant pool capacity reached: #{current.inspect} pools open, " \
    "max_total_connections is #{max_total.inspect}, and no idle pool could " \
    'be evicted to admit another (all pinned or in use). Raise ' \
    'max_total_connections, reduce concurrent tenants, or set ' \
    'pool_overflow_policy to :evict_idle to allow soft overflow.'
  )
end

Instance Attribute Details

#currentObject (readonly)

Returns the value of attribute current.



41
42
43
# File 'lib/apartment/errors.rb', line 41

def current
  @current
end

#max_totalObject (readonly)

Returns the value of attribute max_total.



41
42
43
# File 'lib/apartment/errors.rb', line 41

def max_total
  @max_total
end