RetryBackoffScheduler
Component Detail
Description
Implements exponential backoff scheduling for failed sync attempts on both iOS and Android. It calculates delay intervals based on attempt count and enforces a maximum retry cap to prevent indefinite retries on hard failures. The scheduler integrates with the platform background task APIs to wake the sync service at the appropriate time.
retry-backoff-scheduler
Sources & reasoning
Line 302 explicitly lists "sync queue with retry/backoff" as part of the core offline architecture. The blueprint assigns dedicated components BackgroundSyncService and RetryBackoffScheduler to this feature, confirming it is distinct from the outbox storage layer. Blueprint marks it [MVP], consistent with offline-first being a Phase 1 foundational requirement across all organizations.
-
docs/source/likeperson.md · line 302Offline-first persistence (Drift + SQLCipher encrypted local DB, mutation outbox, sync queue with retry/backoff, ID mapping for offline-created entities, conflict resolver)
Responsibilities
- Calculate exponential backoff delay from attempt count and base interval
- Schedule platform background task wakeups (iOS BGAppRefreshTask, Android WorkManager)
- Cancel pending scheduled tasks when sync succeeds
- Enforce maximum retry limit and surface permanent-failure events
- Persist next-scheduled-at timestamps across app lifecycle events
Interfaces
scheduleRetry(attemptCount: number): Promise<void>
cancelPending(): void
getNextRetryDelay(attemptCount: number): number
isMaxRetriesExceeded(attemptCount: number): boolean
onMaxRetriesExceeded(handler: () => void): void