Remove PID management functionality from the bot, including related endpoints and references in the codebase. Update Dockerfile to optimize the build process by separating build and runtime stages. Enhance healthcheck implementation in Dockerfile to use Python instead of curl. Update README to reflect the removal of PID file management and related endpoints.
This commit is contained in:
13
bot.py
13
bot.py
@@ -12,7 +12,6 @@ from config import config
|
||||
from loader import loader
|
||||
from services.infrastructure.http_server import start_http_server, stop_http_server
|
||||
from services.infrastructure.logger import get_logger
|
||||
from services.infrastructure.pid_manager import get_pid_manager, cleanup_pid_file
|
||||
from services.infrastructure.metrics_updater import start_metrics_updater, stop_metrics_updater
|
||||
from config.constants import DEFAULT_HTTP_HOST, DEFAULT_HTTP_PORT
|
||||
|
||||
@@ -23,7 +22,6 @@ logger = get_logger(__name__)
|
||||
async def main():
|
||||
"""Главная функция для запуска бота"""
|
||||
http_runner = None
|
||||
pid_manager = None
|
||||
|
||||
try:
|
||||
logger.info("🤖 Запуск бота анонимных вопросов...")
|
||||
@@ -31,13 +29,6 @@ async def main():
|
||||
logger.info(f"💾 База данных: {config.DATABASE_PATH}")
|
||||
logger.info(f"👑 Администраторы: {config.ADMINS}")
|
||||
|
||||
# Создаем PID файл для отслеживания процесса
|
||||
logger.info("📄 Создание PID файла...")
|
||||
pid_manager = get_pid_manager("anon_bot")
|
||||
if not pid_manager.create_pid_file():
|
||||
logger.error("❌ Не удалось создать PID файл, завершаем работу")
|
||||
return
|
||||
logger.info(f"✅ PID файл создан: {pid_manager.get_pid_file_path()}")
|
||||
|
||||
# Запускаем HTTP сервер для метрик и health check
|
||||
logger.info("🌐 Запуск HTTP сервера для метрик...")
|
||||
@@ -65,10 +56,6 @@ async def main():
|
||||
logger.info("🛑 Остановка HTTP сервера...")
|
||||
await stop_http_server(http_runner)
|
||||
|
||||
# Очищаем PID файл
|
||||
if pid_manager:
|
||||
logger.info("📄 Очистка PID файла...")
|
||||
pid_manager.cleanup_pid_file()
|
||||
|
||||
logger.info("🛑 Бот остановлен")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user