Skip to content

fix: prevent phantom follow-up sync runs with "Starting Sync..." title - #25

Merged
gulp79 merged 2 commits into
gulp79:masterfrom
Forcosigan:fix-phantom-followup-sync-log
Oct 21, 2026
Merged

gulp79 merged 2 commits into
gulp79:masterfrom
Forcosigan:fix-phantom-followup-sync-log

Conversation

@Forcosigan

Copy link
Copy Markdown

*Note for reviewer:
This PR is based on top of PR #22. It touches SyncWorker.kt. Please review/merge that PR first.

Problem

After a scheduled task completes successfully, an additional phantom log entry immediately appears in the sync history:
Starting Sync... sync successful - There was nothing to do. Est. Speed: 0 Б/s Avg. Speed: 0 Б/s.

Cause

  1. In DatabaseHandler.taskFromCursor(), cursor.getLong() was directly called for nullable columns (onFailFollowup, onSuccessFollowup). In Android SQLite, getLong() on a NULL column returns 0L.
  2. When a task finished, followupTask() checked only followUpTaskID == null || followUpTaskID == -1L. Since the value was 0L, it enqueued a follow-up task with ID 0L.
  3. In SyncWorker.doWork(), querying task ID 0L returned null. However, the else branch still invoked postSync() with default failureReason = NO_FAILURE and default title "Starting Sync...", falsely logging a success with 0 transferred files.

Solution

  • DatabaseHandler.kt: Check cursor.isNull() before reading filterId, onFailFollowup and onSuccessFollowup, ensuring unset IDs stay null.
  • SyncWorker.kt:
    • Ensure followupTask() only triggers when followUpTaskID > 0L.
    • Abort immediately in doWork() without calling postSync() when no valid task is retrieved.

@gulp79
gulp79 merged commit 61a9281 into gulp79:master Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants