From 735af0e81d0b5ffaddfc0920a67a9e958085fcd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AE=D1=80=D0=B8=D0=B9=20=D0=A7=D0=B5=D1=80=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=BA=D0=BE?= Date: Fri, 31 Oct 2025 18:04:18 +0300 Subject: [PATCH] =?UTF-8?q?=D1=82=D1=80=D0=B5=D0=B4=D1=8B=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- get_data.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/get_data.py b/get_data.py index 8c061fa..becb136 100644 --- a/get_data.py +++ b/get_data.py @@ -330,8 +330,15 @@ async def lifespan(app: FastAPI): GAME_TODAY = is_today # 4. запускаем "длинные" потоки (они у тебя и так всегда) - threads_long = [ - threading.Thread( + thread_result_consumer = threading.Thread( + target=results_consumer, + daemon=True, + ) + thread_result_consumer.start() + + # 5. Подготовим онлайн и офлайн наборы (как у тебя) + threads_live = [ + threading.Thread( target=get_data_from_API, args=( "pregame", @@ -367,22 +374,13 @@ async def lifespan(app: FastAPI): ), daemon=True, ), - threading.Thread( - target=results_consumer, - daemon=True, - ), - ] - for t in threads_long: - t.start() - # 5. Подготовим онлайн и офлайн наборы (как у тебя) - threads_live = [ threading.Thread( target=get_data_from_API, args=( "game", URLS["game"].format(host=HOST, game_id=game_id, lang=LANG), - 3, + 0.00016, stop_event, ), daemon=True, @@ -487,8 +485,7 @@ async def lifespan(app: FastAPI): # -------- shutdown -------- stop_event.set() - for t in threads_long: - t.join(timeout=1) + thread_result_consumer.join(timeout=1) # офлайн/онлайн ты можешь не делить тут, но оставлю for t in threads_offline: t.join(timeout=1)