Skip to content

Build your personal knowledge base with Trilium Notes

refactor(standalone): drop redundant sync auto-resume trigger

Elian Dorandc0e79cb272a
diff --git a/apps/standalone/src/local-server-worker.ts b/apps/standalone/src/local-server-worker.ts
index d07cb59d62..6f4dc8f23e 100644
--- a/apps/standalone/src/local-server-worker.ts
+++ b/apps/standalone/src/local-server-worker.ts
@@ -309,24 +309,11 @@ async function initialize(): Promise<void> {
} else {
logService.info("[Worker] Database not initialized, skipping becca load (will be loaded during DB initialization)");
- // Auto-resume an interrupted initial sync. If the schema is
- // present and the user already configured sync in a previous
- // session that didn't finish, restart sync from `lastSyncedPull`
- // so the user stays on the sync-in-progress screen without
- // re-entering credentials. The DB will only be marked initialized
- // once `sync()` returns success (handled inside `triggerSync`).
- if (coreModule.sql_init.schemaExists()) {
- const lastSyncedPull = parseInt(
- coreModule.options.getOptionOrNull("lastSyncedPull") ?? "0"
- );
- const syncServerHost = coreModule.options.getOptionOrNull("syncServerHost") ?? "";
- if (lastSyncedPull > 0 && syncServerHost) {
- logService.info(
- `[Worker] Resuming interrupted sync: lastSyncedPull=${lastSyncedPull}, host=${syncServerHost}`
- );
- coreModule.setup.triggerSync();
- }
- }
+ // An interrupted initial sync (schema present but not yet
+ // initialized) is resumed by startSyncTimer()'s kickoff below:
+ // sync() calls setDbAsInitialized() once it converges, and the
+ // client stays on the sync-in-progress screen via the
+ // `syncInProgress` bootstrap flag. No explicit trigger needed here.
}
coreModule.sync.startSyncTimer();