fix(cli): prepare daemon and mirror Vaults during startup

This commit is contained in:
vorotamoroz
2026-09-15 12:06:35 +00:00
parent 7c1c913f1d
commit 70cfbd43a9
12 changed files with 462 additions and 67 deletions
+7 -1
View File
@@ -45,7 +45,13 @@ export class ModuleLiveSyncMain extends AbstractModule {
}
// Ordinary start-up may continue when individual files could not be
// processed. Explicit Fetch and Rebuild flows retain the strict default.
const initialisationResult = await this.services.databaseEvents.initialiseDatabase(false, false, false, true);
const { ignoreSuspending = false, continueOnFileFailure = true } = this.core.startupDatabaseOptions;
const initialisationResult = await this.services.databaseEvents.initialiseDatabase(
false,
false,
ignoreSuspending,
continueOnFileFailure
);
if (initialisationResult === VaultScanResults.FAILED) {
this._log($msg("Ui.Common.LocalDatabaseInitialisationFailed"), LOG_LEVEL_NOTICE);
//TODO:stop all sync.
@@ -25,6 +25,7 @@ describe("ModuleLiveSyncMain", () => {
const log = vi.fn();
const host = {
core: {
startupDatabaseOptions: {},
services: {
appLifecycle: {
onLayoutReady: vi.fn(async () => true),
@@ -58,6 +59,7 @@ describe("ModuleLiveSyncMain", () => {
};
const host = {
core: {
startupDatabaseOptions: {},
services: { appLifecycle },
},
services: {
@@ -77,4 +79,33 @@ describe("ModuleLiveSyncMain", () => {
expect(result).toBe(true);
expect(log).toHaveBeenCalledWith("Ui.Common.SomeFilesCouldNotBeSynchronised", LOG_LEVEL_NOTICE);
});
it("passes strict startup database options to initialisation", async () => {
const initialiseDatabase = vi.fn(async () => false);
const host = {
core: {
startupDatabaseOptions: {
ignoreSuspending: true,
continueOnFileFailure: false,
},
services: {
appLifecycle: {
onLayoutReady: vi.fn(async () => true),
},
},
},
services: {
databaseEvents: { initialiseDatabase },
},
settings: {
suspendFileWatching: false,
suspendParseReplicationResult: false,
},
_log: vi.fn(),
};
await ModuleLiveSyncMain.prototype._onLiveSyncReady.call(host as never);
expect(initialiseDatabase).toHaveBeenCalledWith(false, false, true, false);
});
});