Skip to content

Commit 8bfd960

Browse files
committed
fix: DB connection healthchecks
1 parent 26d9632 commit 8bfd960

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/aleph/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ def get_defaults():
185185
"password": "decentralize-everything",
186186
# Maximum number of concurrent connections to the local PostgreSQL database.
187187
"pool_size": 50,
188+
# Check if DB connections are still alive before reusing them.
189+
"pool_pre_ping": True,
190+
# Recycle DB connections after this many seconds of inactivity.
191+
"pool_recycle": 3600,
188192
},
189193
"ipfs": {
190194
# Whether to enable storage and communication on IPFS.

src/aleph/db/connection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ def make_engine(
6060
),
6161
echo=echo,
6262
pool_size=config.postgres.pool_size.value,
63+
pool_pre_ping=config.postgres.pool_pre_ping.value,
64+
pool_recycle=config.postgres.pool_recycle.value,
6365
)
6466

6567

0 commit comments

Comments
 (0)