UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

36 lines (23 loc) 1.2 kB
--- lang: en title: 'API docs: pooling.poolingservice.run' keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI sidebar: lb4_sidebar editurl: https://github.com/loopbackio/loopback-next/tree/master/extensions/pooling permalink: /doc/en/lb4/apidocs.pooling.poolingservice.run.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/pooling](./pooling.md) &gt; [PoolingService](./pooling.poolingservice.md) &gt; [run](./pooling.poolingservice.run.md) ## 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. <b>Signature:</b> ```typescript run(task: (resource: T) => ValueOrPromise<void>, requestCtx?: Context): Promise<void>; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | task | (resource: T) =&gt; [ValueOrPromise](./context.valueorpromise.md)<!-- -->&lt;void&gt; | A function that accepts a resource and returns a Promise. | | requestCtx | [Context](./context.context.md) | | <b>Returns:</b> Promise&lt;void&gt;