Enhance database connection handling in BotDB class with error checking for file existence and access permissions. Implement methods for database integrity checks and WAL file cleanup. Update database initialization to use absolute project path for improved reliability.

This commit is contained in:
2025-08-26 19:33:11 +03:00
parent 86773cfe20
commit 62af3b73c6
3 changed files with 240 additions and 10 deletions

View File

@@ -14,7 +14,9 @@ class BaseDependencyFactory:
self.config = configparser.ConfigParser()
self.config.read(config_path)
self.settings = {}
self.database = BotDB(current_dir, 'tg-bot-database.db')
# Используем абсолютный путь к директории проекта
project_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
self.database = BotDB(project_dir, 'tg-bot-database.db')
for section in self.config.sections():
self.settings[section] = {}