Skip to content

Commit 0ada72e

Browse files
authored
docs: add maxLifetimeSeconds to Pool docs (#3484)
Wording taken from #3298 (comment)
1 parent 03642ab commit 0ada72e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/pages/apis/pool.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ type Config = {
5050
// to the postgres server. This can be handy in scripts & tests
5151
// where you don't want to wait for your clients to go idle before your process exits.
5252
allowExitOnIdle?: boolean
53+
54+
// Sets a max overall life for the connection.
55+
// A value of 60 would evict connections that have been around for over 60 seconds,
56+
// regardless of whether they are idle. It's useful to force rotation of connection pools through
57+
// middleware so that you can rotate the underlying servers. The default is disabled (value of zero)
58+
maxLifetimeSeconds?: number
5359
}
5460
```
5561
@@ -64,6 +70,7 @@ const pool = new Pool({
6470
max: 20,
6571
idleTimeoutMillis: 30000,
6672
connectionTimeoutMillis: 2000,
73+
maxLifetimeSeconds: 60
6774
})
6875
```
6976

0 commit comments

Comments
 (0)