From edd8124bbd557de44dc813b59575b0c9d54b39d5 Mon Sep 17 00:00:00 2001 From: Devin Cowan Date: Wed, 13 Nov 2024 11:10:13 -0500 Subject: [PATCH] Increase task ping interval --- hsclient/hydroshare.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hsclient/hydroshare.py b/hsclient/hydroshare.py index 895dd59..613754c 100644 --- a/hsclient/hydroshare.py +++ b/hsclient/hydroshare.py @@ -53,6 +53,8 @@ from hsclient.oauth2_model import Token from hsclient.utils import attribute_filter, encode_resource_url, is_aggregation, main_file_type +CHECK_TASK_PING_INTERVAL = 10 + class File(str): """ @@ -1274,7 +1276,7 @@ def aggregation_move(self, aggregation: Aggregation, dst_path: str = "") -> None status = json_response['status'] if status in ("Not ready", "progress"): while aggregation._hs_session.check_task(task_id) != 'true': - time.sleep(1) + time.sleep(CHECK_TASK_PING_INTERVAL) aggregation.refresh() @refresh @@ -1368,7 +1370,7 @@ def retrieve_bag(self, path, save_path=""): file = self.get(path, status_code=200, allow_redirects=True) if file.headers['Content-Type'] != "application/zip": - time.sleep(1) + time.sleep(CHECK_TASK_PING_INTERVAL) return self.retrieve_bag(path, save_path) return self.retrieve_file(path, save_path) @@ -1386,7 +1388,7 @@ def retrieve_zip(self, path, save_path="", params=None): zip_status = json_response['zip_status'] if zip_status == "Not ready": while self.check_task(task_id) != 'true': - time.sleep(1) + time.sleep(CHECK_TASK_PING_INTERVAL) return self.retrieve_file(download_path, save_path) def upload_file(self, path, files, status_code=204):