diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-15 16:12:07 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-15 16:12:07 +0200 |
| commit | 8796ed59d2410f3e47a114b6002fdefb8f259304 (patch) | |
| tree | 6f23ecdd11f619a5a0576f82a94353065d1e2d28 /assets/mailsync.sh | |
| parent | 1062eedaff00a46918f379bd70d210ce95861c93 (diff) | |
| download | qtmaildir-8796ed59d2410f3e47a114b6002fdefb8f259304.tar.gz qtmaildir-8796ed59d2410f3e47a114b6002fdefb8f259304.zip | |
fix(sync): send held edits before the sync-end refresh reads the database
An edit made while a sync is running is held rather than sent, because the
worker's read-write open blocks on notmuch's exclusive lock. At sync end
onExternalSyncStateChanged() refreshed the list first and flushed the held
edits afterwards, so the refresh read a database that still carried the old
tag, reconciled it into the model, and overwrote the optimistic update the hold
had deliberately left applied. The flush then wrote the tag correctly.
The database ended up right and the list ended up wrong, with nothing scheduled
to re-read it, which is why it looked like the edit had been lost. Reported by
hand: a message read during a sync went back to unread when the sync finished.
The flush moves ahead of the refresh and keeps both properties it already had.
It stays outside the Idle branch, so edits held when /proc/locks becomes
unreadable are not stranded waiting for an Idle that never comes, and it stays
after the status-bar retire, so its own "N held changes sent" message survives.
Both orders leave identical end state, so the first version of the test passed
against the defect: after the handler returns the queue is empty and the write
has been sent whichever ran first. flushGenerationForTesting() stamps the query
generation at flush time, which is what separates them, and the test fails
against the old order with Actual: 3, Expected: 2.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'assets/mailsync.sh')
0 files changed, 0 insertions, 0 deletions
