File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 6060LOGIN_URL = 'https://api.digitalcombatsimulator.com/gameapi/login/'
6161LOGOUT_URL = 'https://api.digitalcombatsimulator.com/gameapi/logout/'
6262UPDATER_URL = 'https://api.digitalcombatsimulator.com/gameapi/updater/branch/{}/'
63- LICENSES_URL = 'https://api .digitalcombatsimulator.com/checklicenses.php'
63+ LICENSES_URL = 'https://www .digitalcombatsimulator.com/checklicenses.php'
6464
6565# Internationalisation
6666_ = get_translation ('core' )
@@ -247,15 +247,15 @@ async def init_db(self) -> tuple[ConnectionPool, AsyncConnectionPool]:
247247 pass
248248 # quick connection check
249249 max_attempts = self .config .get ("database" , self .locals .get ('database' )).get ('max_retries' , 10 )
250- for attempt in range (max_attempts ):
250+ for attempt in range (max_attempts + 1 ):
251251 try :
252- aconn = await psycopg .AsyncConnection .connect (url )
252+ aconn = await psycopg .AsyncConnection .connect (url , connect_timeout = 5 )
253253 async with aconn :
254254 cursor = await aconn .execute ("SHOW server_version" )
255255 version = (await cursor .fetchone ())[0 ]
256256 self .log .info (f"- Connection to PostgreSQL { version } established." )
257257 break
258- except OperationalError :
258+ except ConnectionTimeout :
259259 if attempt == max_attempts :
260260 raise
261261 self .log .warning ("- Database not available, trying again in 5s ..." )
You can’t perform that action at this time.
0 commit comments