diff --git a/milvus/utils/Function.ts b/milvus/utils/Function.ts index d85a8ddf..aeada05c 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); }