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()