Remove .env_example file and implement MetricsUpdater service for enhanced metrics tracking. Update bot.py to start and stop metrics updater, and improve database connection handling in CRUD operations with metrics tracking. Update README with details on metrics issues and fixes.

This commit is contained in:
2025-09-08 23:18:55 +03:00
parent 596a2fa813
commit 23c30a78e2
11 changed files with 744 additions and 49 deletions

View File

@@ -22,11 +22,11 @@ class DatabaseService:
def __init__(self, db_path: str):
self.db_path = db_path
# Инициализируем CRUD операции
self.users = UserCRUD(db_path)
self.questions = QuestionCRUD(db_path)
self.user_blocks = UserBlockCRUD(db_path)
self.user_settings = UserSettingsCRUD(db_path)
# Инициализируем CRUD операции с передачей логгера
self.users = UserCRUD(db_path, logger)
self.questions = QuestionCRUD(db_path, logger)
self.user_blocks = UserBlockCRUD(db_path, logger)
self.user_settings = UserSettingsCRUD(db_path, logger)
async def init(self):
"""Инициализация базы данных и создание таблиц"""
@@ -59,7 +59,7 @@ class DatabaseService:
return
# Читаем схему из файла
schema_path = Path(__file__).parent.parent / "database" / "schema.sql"
schema_path = Path(__file__).parent.parent.parent / "database" / "schema.sql"
if schema_path.exists():
logger.info("📄 Создание таблиц из схемы")