From 9e484b3493fe532e2535a5a126758e25b66b6a10 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:47:30 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20host=20=D0=BD=D0=B0=20pro=20=D0=B8=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=20=D1=82=D0=B0=D0=B9=D0=BC?= =?UTF-8?q?-=D0=B0=D1=83=D1=82=20=D0=BD=D0=B0=20=D0=BB=D0=B0=D0=B9=D0=B2-?= =?UTF-8?q?=D1=82=D1=80=D0=B5=D0=B4=D0=B5=20=D0=BD=D0=B0=201=20=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- get_data.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/get_data.py b/get_data.py index 4f22f98..235405d 100644 --- a/get_data.py +++ b/get_data.py @@ -29,7 +29,7 @@ args = parser.parse_args() LEAGUE = args.league TEAM = args.team LANG = args.lang -HOST = "https://ref.russiabasket.org" +HOST = "https://pro.russiabasket.org" STATUS = False GAME_ID = None SEASON = None @@ -70,7 +70,7 @@ def get_data_from_API( while not stop_event.is_set(): start = time.time() try: - value = requests.get(url).json() + value = requests.get(url, timeout=5).json() except Exception as ex: value = {"error": str(ex)} ts = datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")[:-3] @@ -433,7 +433,7 @@ async def lifespan(app: FastAPI): args=( "live-status", URLS["live-status"].format(host=HOST, game_id=game_id), - 3, + 1, stop_event, ), daemon=True, @@ -443,7 +443,7 @@ async def lifespan(app: FastAPI): args=( "box-score", URLS["box-score"].format(host=HOST, game_id=game_id), - 3, + 1, stop_event, ), daemon=True, @@ -453,7 +453,7 @@ async def lifespan(app: FastAPI): args=( "play-by-play", URLS["play-by-play"].format(host=HOST, game_id=game_id), - 3, + 1, stop_event, ), daemon=True, @@ -528,12 +528,11 @@ async def lifespan(app: FastAPI): # -------- shutdown -------- stop_event.set() - thread_result_consumer.join(timeout=1) # офлайн/онлайн ты можешь не делить тут, но оставлю - for t in threads_offline: - t.join(timeout=1) - for t in threads_live: + stop_event.set() + for t in threads_live + threads_offline: t.join(timeout=1) + thread_result_consumer.join(timeout=1) app = FastAPI(lifespan=lifespan)