Enhance bot functionality and refactor database interactions

- Added `ca-certificates` installation to Dockerfile for improved network security.
- Updated health check command in Dockerfile to include better timeout handling.
- Refactored `run_helper.py` to implement proper signal handling and logging during shutdown.
- Transitioned database operations to an asynchronous model in `async_db.py`, improving performance and responsiveness.
- Updated database schema to support new foreign key relationships and optimized indexing for better query performance.
- Enhanced various bot handlers to utilize async database methods, improving overall efficiency and user experience.
- Removed obsolete database and fix scripts to streamline the project structure.
This commit is contained in:
2025-09-02 18:22:02 +03:00
parent 013892dcb7
commit 1c6a37bc12
59 changed files with 5682 additions and 4204 deletions

View File

@@ -2,7 +2,7 @@ import os
import sys
from dotenv import load_dotenv
from database.db import BotDB
from database.async_db import AsyncBotDB
class BaseDependencyFactory:
@@ -18,10 +18,7 @@ class BaseDependencyFactory:
if not os.path.isabs(database_path):
database_path = os.path.join(project_dir, database_path)
database_dir = project_dir
database_name = database_path.replace(project_dir + '/', '')
self.database = BotDB(database_dir, database_name)
self.database = AsyncBotDB(database_path)
self._load_settings_from_env()
@@ -60,7 +57,7 @@ class BaseDependencyFactory:
def get_settings(self):
return self.settings
def get_db(self) -> BotDB:
def get_db(self) -> AsyncBotDB:
"""Возвращает подключение к базе данных."""
return self.database