From abf0d7660381dc5a3f701fa5f41b0c8b90a8dd4a Mon Sep 17 00:00:00 2001 From: Alecks Gates Date: Sun, 19 Sep 2021 23:18:45 -0500 Subject: [PATCH 1/2] Version 1.0.2 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8f8acaf..721cc39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "podping-hivewriter" -version = "1.0.1" +version = "1.0.2" license = "MIT" authors = ["Alecks Gates ", "Brian of London "] maintainers = ["Alecks Gates ", "Brian of London "] From aeaf8590fb8395e62819b5dd89883c71cbab2f03 Mon Sep 17 00:00:00 2001 From: Alecks Gates Date: Sun, 19 Sep 2021 23:22:31 -0500 Subject: [PATCH 2/2] failure_retry waits 2 seconds for every retry up to 5 minutes --- src/podping_hivewriter/constants.py | 3 --- src/podping_hivewriter/podping_hivewriter.py | 11 +++++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/podping_hivewriter/constants.py b/src/podping_hivewriter/constants.py index 95dab14..1e05fdb 100644 --- a/src/podping_hivewriter/constants.py +++ b/src/podping_hivewriter/constants.py @@ -10,6 +10,3 @@ # Operation JSON must be less than or equal to 8192 bytes. HIVE_CUSTOM_OP_DATA_MAX_LENGTH = 8192 -# This is a global signal to shut down until RC's recover -# Stores the RC cost of each operation to calculate an average -HIVE_HALT_TIMES = [0, 1, 1, 1, 1, 1, 1, 1, 3, 6, 9, 15, 15, 15, 15, 15, 15, 15] diff --git a/src/podping_hivewriter/podping_hivewriter.py b/src/podping_hivewriter/podping_hivewriter.py index 15aa21d..c796bb4 100644 --- a/src/podping_hivewriter/podping_hivewriter.py +++ b/src/podping_hivewriter/podping_hivewriter.py @@ -20,7 +20,6 @@ STARTUP_FAILED_UNKNOWN_EXIT_CODE, STARTUP_OPERATION_ID, CURRENT_PODPING_VERSION, - HIVE_HALT_TIMES, HIVE_CUSTOM_OP_DATA_MAX_LENGTH, ) from podping_hivewriter.exceptions import PodpingCustomJsonPayloadExceeded @@ -399,11 +398,11 @@ async def failure_retry(self, iri_set: Set[str]) -> Tuple[str, int]: failure_count = 0 while True: + # Sleep a maximum of 5 minutes, 2 additional seconds for every retry + sleep_time = min(failure_count * 2, 300) if failure_count > 0: - logging.warning( - f"Waiting {HIVE_HALT_TIMES[failure_count]}s before retry" - ) - await asyncio.sleep(HIVE_HALT_TIMES[failure_count]) + logging.warning(f"Waiting {sleep_time}s before retry") + await asyncio.sleep(sleep_time) logging.info( f"FAILURE COUNT: {failure_count} - RETRYING {len(iri_set)} IRIs" ) @@ -414,7 +413,7 @@ async def failure_retry(self, iri_set: Set[str]) -> Tuple[str, int]: trx_id = await self.send_notification_iris(iris=iri_set) if failure_count > 0: logging.info( - f"----> FAILURE CLEARED after {failure_count} retries <-----" + f"FAILURE CLEARED after {failure_count} retries, {sleep_time}s" ) return trx_id, failure_count except Exception: