From 3aca520d24666e57820bc54ad95e93bfc4829cd5 Mon Sep 17 00:00:00 2001 From: luiz-rissardi Date: Fri, 16 May 2025 22:50:15 -0300 Subject: [PATCH] add automatic connection release with Symbol.asyncDispose after executing a query --- lib/commands/query.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/commands/query.js b/lib/commands/query.js index 117e4bac70..3f7317dde3 100644 --- a/lib/commands/query.js +++ b/lib/commands/query.js @@ -322,6 +322,12 @@ class Query extends Command { this.emit('error', err); } } + + async [Symbol.asyncDispose](){ + if(this._connection){ + await this._connection.release(); + } + } } Query.prototype.catch = Query.prototype.then;