From 1074fea1b5c463999eadbcbff23805892c027a66 Mon Sep 17 00:00:00 2001 From: Norm Brandinger Date: Mon, 2 Aug 2021 19:37:15 -0400 Subject: [PATCH] fix: allow db_url connect_timeout value to override modparam timeout value --- modules/db_postgres/pg_con.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/db_postgres/pg_con.c b/modules/db_postgres/pg_con.c index b076f27ad3d..414c168d05e 100644 --- a/modules/db_postgres/pg_con.c +++ b/modules/db_postgres/pg_con.c @@ -120,6 +120,11 @@ int db_postgres_connect(struct pg_con* ptr) } } + /* force the default timeout */ + if (pq_timeout > 0) { + PSQL_PARAM("connect_timeout", int2str(pq_timeout, 0)); + } + if (id->parameters) { lenp = strlen(id->parameters); @@ -198,11 +203,6 @@ int db_postgres_connect(struct pg_con* ptr) LM_DBG("opening connection: postgres://xxxx:xxxx@%s/%s %s\n", ZSW(id->host), ZSW(id->database), ZSW(dbname)); } - /* force the default timeout */ - if (pq_timeout > 0) { - PSQL_PARAM("connect_timeout", int2str(pq_timeout, 0)); - } - /* End of the parameter list */ PSQL_PARAM(0, 0);