Service Layer high complexity mobile
4
Dependencies
2
Dependents
3
Entities
0
Integrations

Description

Core orchestrator that drains the mutation outbox in FIFO order by dispatching queued mutations through ApiHttpClient and committing results atomically within Drift transactions. Triggered both immediately on connectivity restoration (via ConnectivityMonitorService) and periodically by the background task scheduler.

Feature: Background Sync

sync-queue-service

Responsibilities

  • Read pending mutations from the Mutation Outbox in FIFO order
  • Dispatch each mutation via ApiHttpClient and commit success or failure within a Drift transaction
  • Coordinate with RetryBackoffService to determine delay and dead-letter transitions
  • Update SyncStateProvider with current pending count, last sync time, and dead-letter count
  • Prevent concurrent drain runs using a mutex or in-progress flag

Interfaces

drainOutbox() -> Future<SyncResult>
cancelSync() -> void
getSyncState() -> Stream<SyncState>