From 9790f0c7d2e709b4eaa916525a494883bd136f70 Mon Sep 17 00:00:00 2001 From: Shantanu Date: Tue, 22 Jun 2021 00:21:23 -0700 Subject: [PATCH 1/2] reset idle timeout --- lib/connection.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/connection.js b/lib/connection.js index f8578176..e90e50c5 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -149,6 +149,8 @@ function Connection(options = {}) { : (messages.push(buffer), connect()) } catch (err) { query.reject(err) + } + finally { idle() } } From 50d22adbfa88ef90e04e8e2d9e8d018b6c38af31 Mon Sep 17 00:00:00 2001 From: Shantanu Date: Sun, 27 Jun 2021 15:38:18 -0700 Subject: [PATCH 2/2] clear timeout unconditionally --- lib/connection.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/connection.js b/lib/connection.js index e90e50c5..3d8888f1 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -151,7 +151,8 @@ function Connection(options = {}) { query.reject(err) } finally { - idle() + clearTimeout(timer) + timer = setTimeout(socket.end, idle_timeout * 1000) } }