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 "] 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: