feat: Adaptive sync, dedicated channels, and event notifications#7
Open
matthieup240 wants to merge 5 commits intoMr-Pepe:mainfrom
Open
feat: Adaptive sync, dedicated channels, and event notifications#7matthieup240 wants to merge 5 commits intoMr-Pepe:mainfrom
matthieup240 wants to merge 5 commits intoMr-Pepe:mainfrom
Conversation
- Add SyncEvent classes to track sync events (itemReceived, syncStarted, syncCompleted) - Add optional callbacks to SyncManager constructor (onItemReceived, onSyncStarted, onSyncCompleted) - Track sync event sources (realtime vs fullSync) - Emit events when items are received, syncs start/complete - Add comprehensive documentation and examples in README - Add tests for sync event notifications - Backward compatible implementation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add intelligent sync interval adjustment based on user activity patterns to optimize battery consumption while maintaining responsiveness. Features: - Adaptive sync modes (active/recent/idle) with variable intervals (5s/15s/30s) - Immediate sync triggering when changes detected in idle/recent modes - Periodic safety checks: re-sync from Drift every 20 iterations - Immediate processing of realtime events for instant UI updates - Improved retry logic for failed sync operations Benefits: - Reduced battery consumption during idle periods (30s interval) - Maximum responsiveness during active editing (5s interval) - Data consistency safeguards with periodic Drift re-syncs - Instant realtime updates without waiting for sync loop
Owner
|
I already didn't find the time to review your last PR and this one is way bigger, so I don't know when I'll find the time to go through it, sorry. However, thank you very much for the contribution, I can already see that you've added some cool stuff 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces several improvements to the sync system:
Features
Adaptive Sync Intervals
Dedicated Realtime Channels
Event Notification System
ChangeNotifierAPI for basic use casesonSyncStarted/onSyncCompleted) for advanced scenariosSafety & Reliability
Breaking Changes
None - fully backward compatible
Testing
All existing tests pass. Adaptive sync tested in production app.