[OPTIMIZATION] Communication Logger Hook - Concurrency & Error Handling - src/hooks/useCommunicationLogger.ts #60

Closed
opened 2026-06-06 20:45:41 +00:00 by Mark · 0 comments
Owner

Critical Issues (1)

  1. 3 sequential native fetches in interval (calls, SMS, emails)
    • Fix: Promise.all parallel execution
    • Impact: 2-3x faster background sync

High Issues (3)

  1. Preview arrays grow unbounded - no max-size cap or TTL eviction

    • Fix: Add MAX_PREVIEWS = 500, slice oldest entries
    • Impact: Prevents linear memory leak
  2. No circuit breaker - keeps hammering native layer after repeated failures

    • Fix: Stop interval after 5 consecutive failures
  3. Swallowed errors, no UI notification - user sees stale data silently

    • Fix: Expose syncError state for retry UI

Medium Issues (2)

  1. No timeout on native calls - can hang indefinitely

    • Fix: Promise.race + 5s timeout
  2. No retry on transient failures - single hiccup = failed sync cycle

    • Fix: 3-attempt exponential backoff (1s/2s/4s)
## Critical Issues (1) 1. **3 sequential native fetches** in interval (calls, SMS, emails) - Fix: `Promise.all` parallel execution - Impact: 2-3x faster background sync ## High Issues (3) 2. **Preview arrays grow unbounded** - no max-size cap or TTL eviction - Fix: Add `MAX_PREVIEWS = 500`, slice oldest entries - Impact: Prevents linear memory leak 3. **No circuit breaker** - keeps hammering native layer after repeated failures - Fix: Stop interval after 5 consecutive failures 4. **Swallowed errors, no UI notification** - user sees stale data silently - Fix: Expose `syncError` state for retry UI ## Medium Issues (2) 5. **No timeout on native calls** - can hang indefinitely - Fix: `Promise.race` + 5s timeout 6. **No retry on transient failures** - single hiccup = failed sync cycle - Fix: 3-attempt exponential backoff (1s/2s/4s)
Mark 2026-06-14 07:20:18 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/kimi_agent_kin_app_sync#60
No description provided.