Ir al contenido principal

createObjectPoolProxy

Callable

  • createObjectPoolProxy<T>(instances: T[]): Pooled<T>

  • Creates a proxy that distributes method calls and property accesses across a pool of object instances. Only one ongoing access per instance is allowed at a time. If all instances are busy, accesses wait until one becomes free.

    The returned proxy provides a promisified version of the original interface: method calls and property accesses all return promises.

    Methods may return streamed response objects whose work continues after the method promise resolves. When a returned value exposes a finished promise, the pool keeps the instance checked out until that promise settles.


    Type parameters

    • T: object

    Parameters

    • instances: T[]

    Returns Pooled<T>