aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-29 11:30:08 +0200
committerDanilo M. <danix@danix.xyz>2026-08-29 11:30:08 +0200
commit063be87405277aef3122c448b064241fd15f2a92 (patch)
tree1538f216ce1e31e7be334952be7c5ad8d48c35a8 /src
parent3fd999907ae8344f76ee4e5be1ac278a26f452ca (diff)
downloadqtmaildir-063be87405277aef3122c448b064241fd15f2a92.tar.gz
qtmaildir-063be87405277aef3122c448b064241fd15f2a92.zip
fix: retry a sync that was skipped because another held the lock
Item 125, the half that was genuinely missing. Most of this item was already built and the row was stale. The exit-75 branch in onSyncFinished() predates this session and does what the entry asks: the spinner clears, the skip is reported as neither success nor failure, m_lastSyncFailed stays put, the log pane is not raised, the lock latch is handed back to the external monitor, and the sync-on-exit case has its own dialog. Item 174 then added the external half, a `skipped` state a run the application did not start can be seen to have produced. What nothing covered was the RE-ARM, and it is the symptom the item was filed for. runAutoSync() re-arms when it declines to START, which is item 89 and covers a sync skipped before launching. A run that LAUNCHES, finds the lock held and exits 75 reaches onSyncFinished() instead, and that branch armed nothing: the edit stayed pending with nothing scheduled to carry it, waiting for a manual sync or the next cron tick. That is "a held edit waits for a completion that never comes". scheduleAutoSync() in the skip branch. It re-checks the delay, the sync command and the pending count on the way in, so it cannot arm a sync for nothing, and against a long external run it re-arms once per debounce interval until the lock clears. This is the half the status file could not reach, and the distinction is worth keeping: that file says what a run DID, this is what the application does NEXT. The test records a real pending edit first, since runAutoSync() correctly declines when there is nothing to carry and a fixture without one would arm nothing for a legitimate reason. It failed before the fix and is mutation-checked. Suite: 43 of 44, with undoMovesTheMessageBack failing as it does on master (item 136).
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 01c0251..4859b1f 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -4688,6 +4688,23 @@ void MainWindow::onSyncFinished(bool success, int exitCode)
showTransientStatus(tr("A sync is already running (started "
"elsewhere); this one was skipped"));
+ // Item 125's other half, and the one the status file cannot reach:
+ // that file says what a run DID, this is what the application does
+ // next. The run carried nothing, so something has to carry the edit.
+ //
+ // runAutoSync() already re-arms when it declines to START (item 89),
+ // which covers a sync skipped before launching. A run that launches,
+ // finds the lock held and exits 75 arrives HERE instead, and armed
+ // nothing: the edit then waited for a manual sync or the next cron
+ // tick, which is the "held edit waits for a completion that never
+ // comes" the item was filed for.
+ //
+ // scheduleAutoSync() re-checks the delay, the sync command and the
+ // pending count on the way in, so this cannot arm a sync for nothing,
+ // and against a long external run it re-arms once per debounce
+ // interval until the lock clears.
+ scheduleAutoSync();
+
if (m_syncingForExit) {
// The other run is syncing, but this application cannot see when
// it finishes, so it cannot promise the changes are across. Leave