fixed redundant telegram calls

This commit is contained in:
Alishahryar1
2026-01-30 15:46:49 -08:00
parent 7045e0ed44
commit 8aae7c3d3d
2 changed files with 6 additions and 2 deletions
+4 -2
View File
@@ -174,6 +174,7 @@ class ClaudeMessageHandler:
}
last_ui_update = 0.0
last_displayed_text = None
captured_session_id = None
temp_session_id = None
@@ -185,7 +186,7 @@ class ClaudeMessageHandler:
logger.info(f"Will fork from parent session: {parent_session_id}")
async def update_ui(status: Optional[str] = None, force: bool = False) -> None:
nonlocal last_ui_update
nonlocal last_ui_update, last_displayed_text
now = time.time()
# Small 1s debounce for UI sanity - we still want to avoid
@@ -195,7 +196,8 @@ class ClaudeMessageHandler:
last_ui_update = now
display = self._build_message(components, status)
if display:
if display and display != last_displayed_text:
last_displayed_text = display
# Use queued edit for non-blocking, thread-safe UI updates
# Rate limiting and flood wait retries are handled by GlobalRateLimiter
await self.platform.queue_edit_message(
+2
View File
@@ -159,6 +159,8 @@ class TelegramPlatform(MessagingPlatform):
try:
return await func(*args, **kwargs)
except (NetworkError, asyncio.TimeoutError) as e:
if "Message is not modified" in str(e):
return None
last_error = e
if attempt < max_retries - 1:
wait_time = 2**attempt # 1s, 2s, 4s