From 9194f77e71ba69bc290d907015b11709d6f8d8e8 Mon Sep 17 00:00:00 2001 From: jsc0218 Date: Mon, 13 Nov 2023 02:11:31 +0000 Subject: [PATCH] change default value of PG's conn timeout and try times to avoid endless wait when conn url is unavailable --- src/Core/PostgreSQL/PoolWithFailover.h | 2 +- src/Core/PostgreSQL/Utils.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/PostgreSQL/PoolWithFailover.h b/src/Core/PostgreSQL/PoolWithFailover.h index bf9c34e67239..bf3782afba40 100644 --- a/src/Core/PostgreSQL/PoolWithFailover.h +++ b/src/Core/PostgreSQL/PoolWithFailover.h @@ -14,7 +14,7 @@ static constexpr inline auto POSTGRESQL_POOL_DEFAULT_SIZE = 16; static constexpr inline auto POSTGRESQL_POOL_WAIT_TIMEOUT = 5000; -static constexpr inline auto POSTGRESQL_POOL_WITH_FAILOVER_DEFAULT_MAX_TRIES = 5; +static constexpr inline auto POSTGRESQL_POOL_WITH_FAILOVER_DEFAULT_MAX_TRIES = 2; namespace postgres { diff --git a/src/Core/PostgreSQL/Utils.cpp b/src/Core/PostgreSQL/Utils.cpp index b4ad19c819ad..810bf62fdab3 100644 --- a/src/Core/PostgreSQL/Utils.cpp +++ b/src/Core/PostgreSQL/Utils.cpp @@ -16,7 +16,7 @@ ConnectionInfo formatConnectionString(String dbname, String host, UInt16 port, S << " port=" << port << " user=" << DB::quote << user << " password=" << DB::quote << password - << " connect_timeout=10"; + << " connect_timeout=2"; return {out.str(), host + ':' + DB::toString(port)}; }