Skip to content

Commit

Permalink
Merge branch 'hotfix/1.0.2' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
agates committed Sep 20, 2021
2 parents 93feabb + aeaf859 commit 86ea24b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "podping-hivewriter"
version = "1.0.1"
version = "1.0.2"
license = "MIT"
authors = ["Alecks Gates <[email protected]>", "Brian of London <[email protected]>"]
maintainers = ["Alecks Gates <[email protected]>", "Brian of London <[email protected]>"]
Expand Down
3 changes: 0 additions & 3 deletions src/podping_hivewriter/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
11 changes: 5 additions & 6 deletions src/podping_hivewriter/podping_hivewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
)
Expand All @@ -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:
Expand Down

0 comments on commit 86ea24b

Please sign in to comment.