From da162a1856a32235e619578aa423c43d37791cc1 Mon Sep 17 00:00:00 2001 From: Wojciech Kosior Date: Wed, 17 Jun 2020 17:27:26 +0200 Subject: specify timeout when connecting to database --- src/ztdnslib.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ztdnslib.py b/src/ztdnslib.py index 8ac0169..7b8532e 100644 --- a/src/ztdnslib.py +++ b/src/ztdnslib.py @@ -13,7 +13,8 @@ def get_ztdns_config(): def start_db_connection(config): connection = psycopg2.connect(user=config['user'], password=config['password'], host=config['host'], port=config['port'], - database=config['database']) + database=config['database'], + connect_timeout=10) # we might later decide that each user of start_db_connection() # should set it themselves - but for now, set it here connection.autocommit = True -- cgit v1.2.3