Exception: Apartment::PoolCapacityReached

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

Overview

Raised when admitting a new tenant pool would exceed the effective pool budget (Config#effective_pool_budget) 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. The message names the knobs that set it, never the deprecated max_total_connections: that name is what made the budget look like a connection count in the first place. See docs/designs/pool-connection-budget.md and 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.



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/apartment/errors.rb', line 50

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

Instance Attribute Details

#currentObject (readonly)

max_total is the effective POOL budget, not a connection count. The reader keeps its name for compatibility with anything already rescuing this.



46
47
48
# File 'lib/apartment/errors.rb', line 46

def current
  @current
end

#max_totalObject (readonly) Also known as: pool_budget

max_total is the effective POOL budget, not a connection count. The reader keeps its name for compatibility with anything already rescuing this.



46
47
48
# File 'lib/apartment/errors.rb', line 46

def max_total
  @max_total
end