Skip to content

Commit a61376d

Browse files
committed
Bugfix: Indexing won't start on fresh DB
(Caused by our recent changes) `resume_or_scan()` set `scanning = true` early to suppress the verifier during startup, but `start_scan()` then rejected with "Scan already running" because its guard checks the same flag before setting it. - Move the early `scanning = true` from `resume_or_scan()` into `start_replay()` — the only path that doesn't go through `start_scan()` - `start_scan()` still sets the flag itself, so both paths are covered - The fallback-from-replay and manual-start paths work correctly because `scanning` is `false` when they call `start_scan()`
1 parent 77ebaa0 commit a61376d

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

  • apps/desktop/src-tauri/src/indexing

apps/desktop/src-tauri/src/indexing/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,6 @@ impl IndexManager {
266266
///
267267
/// **No existing index:** Full scan via `start_scan()`.
268268
pub fn resume_or_scan(&mut self) -> Result<(), String> {
269-
// Suppress verifier and other concurrent reads until replay/scan completes.
270-
// start_scan() sets this again (harmless), and both scan and replay
271-
// completion paths reset it to false.
272-
self.scanning.store(true, Ordering::Relaxed);
273-
274269
let status = self
275270
.store
276271
.get_index_status()
@@ -379,6 +374,10 @@ impl IndexManager {
379374
None
380375
};
381376

377+
// Suppress verifier until replay completes. The spawned task resets
378+
// this to false when replay is done (or on fallback to full scan).
379+
self.scanning.store(true, Ordering::Relaxed);
380+
382381
// Spawn the replay event processing loop
383382
let writer = self.writer.clone();
384383
let app = self.app.clone();

0 commit comments

Comments
 (0)