Skip to content

search: async background refresh with notmuch revision check#134

Open
klement wants to merge 2 commits intoakissinger:masterfrom
klement:search-async-refresh
Open

search: async background refresh with notmuch revision check#134
klement wants to merge 2 commits intoakissinger:masterfrom
klement:search-async-refresh

Conversation

@klement
Copy link
Copy Markdown
Contributor

@klement klement commented Apr 10, 2026

Summary

  • Avoids a full model reset when only a single thread's tags changed — instead updates just that row, so the selection and scroll position are preserved.
  • After a mail sync, checks the notmuch database revision counter and skips the refresh entirely if nothing changed.
  • Runs search panel refreshes asynchronously via QProcess so the UI is never blocked during large mailbox scans.

Together these changes make periodic sync refreshes nearly invisible to the user in the common case where no new mail arrived.

Test plan

  • Trigger a mail sync that produces new mail — panels refresh and show updated results
  • Trigger a mail sync with no changes — panels are not refreshed (check log output)
  • Tag a single message — only that row updates, selection stays on the current thread
  • With a large mailbox, verify the UI remains responsive during refresh

klement and others added 2 commits April 10, 2026 08:14
Use dataChanged for updates and beginRemoveRows for removals instead
of beginResetModel/endResetModel, so Qt only repaints the affected row
rather than rebuilding the entire view. Eliminates UI stalls on large
search results (e.g. 3500 threads).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
After each mail sync, check the notmuch database revision via
'notmuch count --lastmod' before doing any work. If the revision is
unchanged (no mail arrived), skip all refreshes entirely.

When mail does arrive, search panels refresh concurrently in the
background via QProcess so the UI thread is never blocked. A
_refreshing guard prevents duplicate refreshes; a second call while
one is in flight is silently dropped and the in-flight refresh still
finalises normally. Tab switches are instant since data is already
fresh by the time the user looks.

Other panel types (thread, compose) stay on the existing lazy-dirty
path and refresh synchronously on next focus.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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