MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / release

Method release

extensions/pooling/src/pooling.ts:216–239  ·  view source on GitHub ↗

* Release the resource back to the pool. * @param resource - Resource instance to be returned back to the pool

(resource: T)

Source from the content-addressed store, hash-verified

214 * @param resource - Resource instance to be returned back to the pool
215 */
216 async release(resource: T) {
217 debug(
218 'Releasing a resource from the pool in context %s',
219 this.context.name,
220 resource,
221 );
222 try {
223 // Try factory-level acquire hook first
224 if (this.factory.release) {
225 await this.factory.release(resource);
226 } else {
227 await invokePoolableMethod(resource as Poolable, 'release');
228 }
229 await this.pool.release(resource);
230 } catch (err) {
231 await this.pool.destroy(resource);
232 throw err;
233 }
234 debug(
235 'Resource released to the pool in context %s',
236 this.context.name,
237 resource,
238 );
239 }
240
241 /**
242 * Destroy a resource from the pool

Callers 1

runMethod · 0.95

Calls 3

invokePoolableMethodFunction · 0.85
releaseMethod · 0.65
destroyMethod · 0.45

Tested by

no test coverage detected