diff --git a/sketch_map_tool/__init__.py b/sketch_map_tool/__init__.py index 01353c48..0b77d9d9 100644 --- a/sketch_map_tool/__init__.py +++ b/sketch_map_tool/__init__.py @@ -18,6 +18,7 @@ "task_serializer": "pickle", "task_track_started": True, # report ‘started’ status worker executes task "task_send_sent_event": True, + "task_time_limit": 900, # kill task after 15 minutes "result_serializer": "pickle", "result_extended": True, # save result attributes to backend (e.g. name) "result_compression": "gzip", diff --git a/sketch_map_tool/oqt_analyses/oqt_client.py b/sketch_map_tool/oqt_analyses/oqt_client.py index ce0d3ff6..0943c251 100644 --- a/sketch_map_tool/oqt_analyses/oqt_client.py +++ b/sketch_map_tool/oqt_analyses/oqt_client.py @@ -34,7 +34,11 @@ def bbox_to_feature_collection(bbox: Bbox) -> dict: def get_report(bbox: Bbox, include_svg: bool = True, include_html: bool = False): url = OQT_API_URL + "/" + "reports" + "/" + OQT_REPORT_NAME parameters = {"bpolys": bbox_to_feature_collection(bbox)} - req = requests.post(url, json=parameters) + req = requests.post( + url, + json=parameters, + timeout=(10, 600), # connect timeout (5 seconds), read_timeout (10 minutes) + ) if req.status_code == 422: if req.json()["type"] == "SizeRestrictionError": raise OQTReportError( diff --git a/sketch_map_tool/wms/client.py b/sketch_map_tool/wms/client.py index f394d844..71f67492 100644 --- a/sketch_map_tool/wms/client.py +++ b/sketch_map_tool/wms/client.py @@ -38,7 +38,11 @@ def get_map_image(bbox: Bbox, size: Size) -> Response: } try: return requests.get( - url, params, stream=True, timeout=int(get_config_value("wms-read-timeout")) + url, + params, + stream=True, + # connect timeout (5 seconds), read_timeout (10 minutes) + timeout=(10, int(get_config_value("wms-read-timeout"))), ) except ReadTimeout: raise MapGenerationError(