Skip to content

Commit 4bc0489

Browse files
DPE-7726: Decrease waiting for DB connection timeout
We had to wait 30 seconds in case of lack of connection which is unnecessary long. Also, add details for the reason of failed connection Retry/CannotConnect.
1 parent 2170b05 commit 4bc0489

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/charm.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2299,12 +2299,13 @@ def _can_connect_to_postgresql(self) -> bool:
22992299
if not self.postgresql.password or not self.postgresql.current_host:
23002300
return False
23012301
try:
2302-
for attempt in Retrying(stop=stop_after_delay(30), wait=wait_fixed(3)):
2302+
for attempt in Retrying(stop=stop_after_delay(10), wait=wait_fixed(3)):
23032303
with attempt:
23042304
if not self.postgresql.get_postgresql_timezones():
2305+
logger.debug("Cannot connect to database (CannotConnectError)")
23052306
raise CannotConnectError
23062307
except RetryError:
2307-
logger.debug("Cannot connect to database")
2308+
logger.debug("Cannot connect to database (RetryError)")
23082309
return False
23092310
return True
23102311

0 commit comments

Comments
 (0)