Skip to content

Fix sync race condition causing loss of local feed item state. - #691

Merged
ychescale9 merged 1 commit into
mainfrom
yc/fix-sync-race
Oct 31, 2026
Merged

ychescale9 merged 1 commit into
mainfrom
yc/fix-sync-race

Conversation

@ychescale9

Copy link
Copy Markdown
Member

Fix a race condition where changing feed filters while a sync was in flight could wipe saved_for_later (and podcast_start_position) on persisted items.

Sync used to read existing items for the currently selected sources, copy over the local state, then rewrite each row with INSERT OR REPLACE. If the selection changed after the request went out, items from sources that were no longer selected weren't in that read, so they were rewritten with saved_for_later = false.

Changes:

  • upsertFeedItem now updates only the columns that come from the server, then INSERT OR IGNOREs new rows. Sync no longer touches local-only columns, so there's no pre-read and nothing to carry over. This replaces INSERT OR REPLACE, which deleted and re-inserted rows.
  • The feed items sync timestamp is now recorded for the sources the request used, not the selection at write time. Previously a mid-request filter change could mark the new selection as synced with entries fetched for the old one.
  • Added insertFeedItem for seeding test data.

@ychescale9
ychescale9 merged commit 16ecaf3 into main Oct 31, 2026
7 checks passed
@ychescale9
ychescale9 deleted the yc/fix-sync-race branch October 31, 2026 07:02
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.

1 participant