Background sync in 60 seconds reels
Background sync in 60 seconds1 / 7
Rule #1Your app
will be killed.
Design for it.
The one rule
Android and iOS stop apps that are off screen.
#lifecycle
❚❚
Background sync in 60 seconds2 / 7
Gone- Variables in RAM
- In-flight requests
- Timers and loops
- The JS runtime
Still on disk- SQLite rows
- The outbox
- The sync cursor
- Saved upload parts
If it isn't on disk, it doesn't exist.
What survives a kill
A kill wipes memory instantly.
#lifecycle#persistence
❚❚
Background sync in 60 seconds3 / 7
One edit, end to end
↓
SQLite + outboxone transaction · UI updates now
↓
OS wakes the jobWorkManager · BGTask
↓
Push op_idserver dedupes, assigns seq
↓
Pull by cursorchanges after 1041
↓
Commitdata + cursor, one transaction
One edit, end to end
The user never waits for the network.
#protocol
❚❚
Explain it like a restaurant