Page Contents

Home > @loopback/pooling > PoolingService > run

PoolingService.run() method

Run the task with an acquired resource from the pool. If task is completed successfully, the resource is returned to the pool. Otherwise, the resource is destroyed.

Signature:

run(task: (resource: T) => ValueOrPromise<void>, requestCtx?: Context): Promise<void>;

Parameters

Parameter Type Description
task (resource: T) => ValueOrPromise<void> A function that accepts a resource and returns a Promise.
requestCtx Context (Optional)

Returns:

Promise<void>