From b07a094f340f78c0a00168fb27c35f7f47313a02 Mon Sep 17 00:00:00 2001 From: lukas91 Date: Wed, 12 Jun 2024 12:30:00 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20yandex=5Fway=5Fmp.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yandex_way_mp.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yandex_way_mp.py b/yandex_way_mp.py index 8df1b6b..c3ae2e2 100644 --- a/yandex_way_mp.py +++ b/yandex_way_mp.py @@ -67,7 +67,7 @@ def process_records(records, apikey, queue): origins = f"{record[2]},{record[3]}" destinations = f"{record[5]},{record[6]}" params = {'origins': origins, 'destinations': destinations, 'apikey': apikey, 'departure_time': dep_time} - response = requests.get('https://api.routing.yandex.net/v2/distancematrix', params=params) + response = requests.get('https://api.routing.yandex.net/v2/distancematrix', params=params, timeout=5) route_json = response.json() cursor.execute("BEGIN flm_office.add_way_log(:1, :2, :3, :4); END;", [record[0], response.status_code, response.url, json.dumps(route_json)]) @@ -123,9 +123,9 @@ def process_data(): terminate_processes(processes) processes.clear() - start_next_pool = 10 - logging.info(f"End pool, wait {start_next_pool} seconds") - time.sleep(start_next_pool) + # start_next_pool = 10 + # logging.info(f"End pool, wait {start_next_pool} seconds") + # time.sleep(start_next_pool) terminate_processes(processes) processes.clear()