Shreemanarjun / Shreemanarjun/datum

Bug Report: stopAutoSync() incorrectly clears _pausedAutoSyncUserIds, preventing auto-sync restoration after pause/resume

Open
#2 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
27
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Hi Shreemanarjun,

I've found a critical bug in the Datum library's sync management that prevents auto-sync timers from being properly restored after calling pauseSync() followed by resumeSync().

When pauseSync() is called:

  1. It saves active auto-sync user IDs to _pausedAutoSyncUserIds
  2. It calls stopAutoSync() without parameters
    
    The issue is in stopAutoSync() method:
// In the no-parameter path of stopAutoSync():
if (_isSyncPaused) {
  _pausedAutoSyncUserIds.clear();  // ← This line clears the list!
}

This means that when resumeSync() tries to restore auto-sync timers:

for (final userId in _pausedAutoSyncUserIds) {
  startAutoSync(userId);
}
// _pausedAutoSyncUserIds is now empty, so no timers are restored!

Steps to Reproduce



  1. Start auto-sync for one or more users
  2. Call pauseSync()
  3. Call resumeSync()
  4. Expected: Auto-sync timers should resume
  5. Actual: No auto-sync timers are restored

Thank you for your excellent library!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing pauseSync(), stopAutoSync(), and resumeSync() in the Dart sync-management code, focusing on how _pausedAutoSyncUserIds is handled. Reproduce the pause/resume sequence with one or more users and verify that auto-sync timers are restored afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
distributed-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.