mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Add debug logs when retrying database connection or testing the write permissions
This commit is contained in:
parent
58025b5ff4
commit
9160bf8ce9
1 changed files with 3 additions and 0 deletions
|
|
@ -217,6 +217,7 @@ class Database:
|
|||
|
||||
def test_write(self):
|
||||
"""Test the write access to the database"""
|
||||
self.logger.debug("Testing write access to the database ...")
|
||||
with self.__db_session() as session:
|
||||
table_name = uuid4().hex
|
||||
session.execute(text(f"CREATE TABLE IF NOT EXISTS test_{table_name} (id INT)"))
|
||||
|
|
@ -226,6 +227,8 @@ class Database:
|
|||
def retry_connection(self, *, readonly: bool = False, fallback: bool = False, **kwargs) -> None:
|
||||
"""Retry the connection to the database"""
|
||||
|
||||
self.logger.debug(f"Retrying the connection to the database {'in read-only mode' if readonly else ''}{' with fallback' if fallback else ''} ...")
|
||||
|
||||
assert self.sql_engine is not None
|
||||
|
||||
if fallback and not self.database_uri_readonly:
|
||||
|
|
|
|||
Loading…
Reference in a new issue