Skip to content

Commit f8b37d5

Browse files
committed
fix last details
1 parent a87a6cd commit f8b37d5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

subvortex/core/database/database.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ async def ensure_connection(self):
9696
)
9797

9898
await asyncio.sleep(retry_delay)
99-
# Exponential backoff with cap
100-
retry_delay = min(retry_delay * 1.2, 30.0) # Cap at 30 seconds
99+
100+
# Exponential backoff with cap at 30 seconds
101+
retry_delay = min(retry_delay * 1.2, 30.0)
101102

102103
async def wait_until_ready(self, name: str):
103104
await self.ensure_connection()

subvortex/core/metagraph/metagraph.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,8 @@ async def _notify_with_retry(self, ready) -> bool:
595595
if attempt < max_retries - 1: # Don't delay on last attempt
596596
# Adaptive delay: wait 2-5x the time it took for the check
597597
# This accounts for Redis load, network latency, etc.
598-
adaptive_delay = max(base_delay, check_duration * (2 + attempt * 1.5))
598+
# Cap at 30 seconds to avoid excessive waits during Redis recovery
599+
adaptive_delay = min(max(base_delay, check_duration * (2 + attempt * 1.5)), 30.0)
599600

600601
btul.logging.debug(
601602
f"🔄 Retry {attempt + 1}/{max_retries}: check took {check_duration*1000:.1f}ms, "

0 commit comments

Comments
 (0)