mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-11-03 06:48:18 +00:00
fix(sync): honour readiness and suspension in Customisation Sync
(src/features/ConfigSync/CmdConfigSync.ts) - Call the readiness predicate before accepting configuration file events. - Stop the periodic sweep while settings are applied and let the resume lifecycle scan and restart it once. (src/features/ConfigSync/CmdConfigSync.applySettings.unit.spec.ts) - Exercise the ControlService settings path while active, suspended, and resumed. - Verify that suspended settings application performs no scan and leaves the periodic sweep stopped. (src/features/ConfigSync/CmdConfigSync.readiness.unit.spec.ts) - Cover configuration file events before and after application readiness. (updates.md) - Document the readiness and suspension behaviour.
This commit is contained in:
1 parent
ea30ef7ebd
commit
893a0e26c3
4 files changed
+322
-14
No files matched your search
@@ -1198,20 +1198,11 @@ export class ConfigSync extends LiveSyncCommands {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
async _everyRealizeSettingSyncMode(): Promise<boolean> {
|
||||
_everyRealizeSettingSyncMode(): Promise<boolean> {
|
||||
// applySettings calls onResuming after this handler when synchronisation is active.
|
||||
// That handler scans and restarts the sweep; doing so here would scan twice.
|
||||
this.periodicPluginSweepProcessor?.disable();
|
||||
if (!this._isMainReady) return true;
|
||||
if (!this._isMainSuspended()) return true;
|
||||
if (!this.isThisModuleEnabled()) return true;
|
||||
if (this.settings.autoSweepPlugins) {
|
||||
await this.scanAllConfigFiles(false);
|
||||
}
|
||||
this.periodicPluginSweepProcessor.enable(
|
||||
this.settings.autoSweepPluginsPeriodic && !this.settings.watchInternalFileChanges
|
||||
? PERIODIC_PLUGIN_SWEEP * 1000
|
||||
: 0
|
||||
);
|
||||
return true;
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
recentProcessedInternalFiles = [] as string[];
|
||||
@@ -1488,7 +1479,7 @@ export class ConfigSync extends LiveSyncCommands {
|
||||
}
|
||||
|
||||
async watchVaultRawEventsAsync(path: FilePath) {
|
||||
if (!this._isMainReady) return false;
|
||||
if (!this._isMainReady()) return false;
|
||||
if (this._isMainSuspended()) return false;
|
||||
if (!this.isThisModuleEnabled()) return false;
|
||||
// if (!this.isTargetPath(path)) return false;
|
||||
|
||||
Reference in new issue
Block a user