Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Pool

Hierarchy

  • Pool

Constructors

constructor

Accessors

capacity

  • get capacity(): number

idleCount

  • get idleCount(): number
  • Amount of clients which are not reserved and currently idle in the pool.

    Returns number

waitingCount

  • get waitingCount(): number
  • Total amount of queued client requests when all clients are reserved. It is helpful to monitor this number to see if you need to adjust the size of the pool.

    Returns number

Methods

connect

  • connect(): Promise<PoolClient>
  • Reserve a client from the pool.

    If the pool is full and all clients are currently reserved, this will wait in a FIFO queue until a client becomes available by it being released back to the pool.

    If there are idle clients in the pool it will be returned.

    If the pool is not full a new client will be created and connected.

    Returns Promise<PoolClient>

disconnect

  • disconnect(force?: boolean): Promise<void>
  • Disconnect all clients from server after all pending requests performed. All currently reserved clients will not be returned to the pool and ended in-place after all pending requests performed.

    If {force} set to truthy value - clients pending requests will not be awaited.

    Parameters

    • force: boolean = false

    Returns Promise<void>

getState

  • getState(): PoolState

restore

  • restore(): void

Generated using TypeDoc