From 0de0deb14f795b16d770c17cf8be563a238453f5 Mon Sep 17 00:00:00 2001 From: vrubelroman Date: Wed, 4 Feb 2026 23:51:32 +0300 Subject: [PATCH] delay in config and setup = 5sec --- LichessClientTG_bot/config.py | 2 ++ LichessClientTG_bot/request_queue.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/LichessClientTG_bot/config.py b/LichessClientTG_bot/config.py index f6ab393..f3f17f3 100644 --- a/LichessClientTG_bot/config.py +++ b/LichessClientTG_bot/config.py @@ -27,6 +27,8 @@ else: # Lichess API Configuration LICHESS_API_BASE_URL = "https://lichess.org/api" LICHESS_STATS_API_BASE_URL = "http://localhost:8001" # For Docker container access +# Минимальная задержка (сек) между запросами к Lichess в очереди мониторинга (избежание бана) +LICHESS_REQUEST_QUEUE_MIN_DELAY = 5.0 # Database Configuration def _resolve_database_path() -> str: diff --git a/LichessClientTG_bot/request_queue.py b/LichessClientTG_bot/request_queue.py index d0c0efc..3a81a3d 100644 --- a/LichessClientTG_bot/request_queue.py +++ b/LichessClientTG_bot/request_queue.py @@ -7,6 +7,8 @@ import logging from typing import Callable, Any, Optional, Dict from datetime import datetime +import config + logger = logging.getLogger(__name__) class RequestQueue: @@ -139,6 +141,6 @@ def get_request_queue() -> RequestQueue: """Get the global request queue instance""" global _request_queue if _request_queue is None: - _request_queue = RequestQueue(min_delay=7.0) + _request_queue = RequestQueue(min_delay=config.LICHESS_REQUEST_QUEUE_MIN_DELAY) return _request_queue