From 0b51ab5d4b272248def52684c64571ad64e4c2f6 Mon Sep 17 00:00:00 2001 From: Brian C Date: Thu, 2 Sep 2021 13:30:30 -0500 Subject: [PATCH] Add allowExitOnIdle to pool API documentation Address issue mentioned in https://github.com/brianc/node-postgres/issues/2590 --- content/api/1-pool.mdx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/content/api/1-pool.mdx b/content/api/1-pool.mdx index 9ad28f1..4c8872b 100644 --- a/content/api/1-pool.mdx +++ b/content/api/1-pool.mdx @@ -26,6 +26,17 @@ config = { // maximum number of clients the pool should contain // by default this is set to 10. max?: int, + + // Default behavior is the pool will keep clients open & connected to the backend + // until idleTimeoutMillis expire for each client and node will maintain a ref + // to the socket on the client, keeping the event loop alive until all clients are closed + // after being idle or the pool is manually shutdown with `pool.end()`. + // + // Setting `allowExitOnIdle: true` in the config will allow the node event loop to exit + // as soon as all clients in the pool are idle, even if their socket is still open + // to the postgres server. This can be handy in scripts & tests + // where you don't want to wait for your clients to go idle before your process exits. + allowExitOnIdle?: boolean } ```