From 151ba0d226d1de443c5f639b45d53593e02371d1 Mon Sep 17 00:00:00 2001 From: Taehyung Lim Date: Wed, 17 Jul 2024 20:12:50 +0900 Subject: [PATCH] fix issue with returning a connection to the pool too early (#339) --- milvus/utils/Function.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/milvus/utils/Function.ts b/milvus/utils/Function.ts index d85a8dd..aeada05 100644 --- a/milvus/utils/Function.ts +++ b/milvus/utils/Function.ts @@ -41,14 +41,17 @@ export async function promisify( if (err) { // If there was an error, reject the Promise with the error reject(err); + } else { + // Otherwise, resolve the Promise with the result + resolve(result); + } + if (client) { + pool.release(client); } - // Otherwise, resolve the Promise with the result - resolve(result); } ); } catch (e: any) { reject(e); - } finally { if (client) { pool.release(client); }