UNPKG

@loopback/docs

Version:

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

81 lines (41 loc) 1.48 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. **Signature:** ```typescript run(task: (resource: T) => ValueOrPromise<void>, requestCtx?: Context): Promise<void>; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td markdown="1"> task </td><td markdown="1"> (resource: T) =&gt; [ValueOrPromise](./context.valueorpromise.md)<!-- -->&lt;void&gt; </td><td markdown="1"> A function that accepts a resource and returns a Promise. </td></tr> <tr><td markdown="1"> requestCtx </td><td markdown="1"> [Context](./context.context.md) </td><td markdown="1"> _(Optional)_ </td></tr> </tbody></table> **Returns:** Promise&lt;void&gt;