Skip to content

Commit

Permalink
Don't block the event loop from finishing (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
lideming authored Nov 26, 2022
1 parent 8c1fde1 commit aaee923
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit aaee923

Please sign in to comment.