From aaee92331ad88889b47ebd563e160fa9d7d33790 Mon Sep 17 00:00:00 2001 From: lideming Date: Sat, 26 Nov 2022 23:14:17 +0800 Subject: [PATCH] Don't block the event loop from finishing (#143) --- src/pool.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pool.ts b/src/pool.ts index 8a0bdcf..f1de757 100644 --- a/src/pool.ts +++ b/src/pool.ts @@ -24,6 +24,12 @@ export class PoolConnection extends Connection { log.warning(`error closing idle connection`, error); } }, this.config.idleTimeout); + try { + // Don't block the event loop from finishing + Deno.unrefTimer(this._idleTimer); + } catch (_error) { + // unrefTimer() is unstable API in older version of Deno + } } }