Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit df5efe0

Browse files
authored
Merge pull request #731 from datafold/keepalive_pg
add keepalives for pg
2 parents 076fff2 + 9b8df5d commit df5efe0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

data_diff/databases/postgresql.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ def create_connection(self):
147147

148148
pg = import_postgresql()
149149
try:
150-
self._conn = pg.connect(**self._args)
150+
self._conn = pg.connect(
151+
**self._args, keepalives=1, keepalives_idle=5, keepalives_interval=2, keepalives_count=2
152+
)
151153
if SESSION_TIME_ZONE:
152154
self._conn.cursor().execute(f"SET TIME ZONE '{SESSION_TIME_ZONE}'")
153155
return self._conn

0 commit comments

Comments
 (0)