From f85760a8ddaf6e026b7a2976c10369fcd66208b4 Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Sat, 6 Apr 2024 23:20:34 +0900 Subject: [PATCH] shorten code --- src/concurrency/resource-pool.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/concurrency/resource-pool.ts b/src/concurrency/resource-pool.ts index 60a41e7..6bfcb6e 100644 --- a/src/concurrency/resource-pool.ts +++ b/src/concurrency/resource-pool.ts @@ -89,16 +89,11 @@ export class ResourcePool { // TODO: implement timeout const v = await this._borrow(); - // console.log('borrowed', v); - - const _return = lazyThenable(async () => { - this._return(v); - // console.log('returned', v); - }); + const _return = lazyThenable(() => this._return(v)); return { value: v, - dispose(): PromiseLike { + async dispose(): Promise { return _return; }, [Symbol.asyncDispose]() {