Skip to content

fix: move sync to worker thread and optimize FTS indexing#33

Merged
doodlewind merged 3 commits intomainfrom
fix/issue-27-startup-perf
Apr 2, 2026
Merged

fix: move sync to worker thread and optimize FTS indexing#33
doodlewind merged 3 commits intomainfrom
fix/issue-27-startup-perf

Conversation

@doodlewind
Copy link
Copy Markdown
Contributor

Summary

  • Move syncAll() to a Worker Thread so the Electron main thread is never blocked during initial sync. Eliminates UI freeze on first launch with large datasets.
  • For bulk syncs (>100 new files), drop FTS triggers before insert and rebuild the index once afterward — ~3x faster.
  • Fix install.sh DMG mount path parsing when path contains spaces (e.g. /Volumes/Spool 2).

Benchmark (3000 sessions / 900K messages)

Before After
UI freeze 61s 0s
Sync time 61s 15.6s
Network service crash Yes No

Test plan

  • Mock 3000 sessions, cold start — UI responsive immediately, sync completes in background
  • electron-vite build passes
  • Verify incremental sync (watcher) still works after worker-based initial sync
  • Verify spool:sync-now IPC triggers worker correctly

Closes #27

🤖 Generated with Claude Code

doodlewind and others added 3 commits April 2, 2026 19:36
- Move syncAll() to a Worker Thread so the Electron main thread is never
  blocked during sync. Eliminates UI freeze on first launch with large
  datasets (3000+ sessions caused 61s freeze, now 0s).
- For bulk syncs (>100 files), drop FTS triggers before insert and
  rebuild the index once afterward. Reduces sync time ~3x (61s → 15.6s
  for 3000 sessions / 900K messages).
- Fix install.sh DMG mount path parsing when path contains spaces.

Closes #27

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Deduplicate concurrent runSyncWorker() calls — if a sync is already
  running, return the existing promise instead of spawning a second worker.
  Prevents FTS trigger drop/rebuild race condition.
- Add 'indexing' phase to StatusBar so users see "Building search index…"
  during the FTS rebuild step.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@doodlewind doodlewind merged commit 1a6c067 into main Apr 2, 2026
3 checks passed
@doodlewind doodlewind deleted the fix/issue-27-startup-perf branch April 2, 2026 12:07
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.

App crashes on launch: excessive disk writes (2.1GB in 28s) triggers macOS kill

1 participant