- Fixed the Infinity loop
This commit is contained in:
vorotamoroz committed 2022-10-21 18:20:03 +09:00
1 parent c18b5c24b4
commit d9b69d9a1b
1 file changed
+6 -1
+6 -1
View File
@@ -841,7 +841,8 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
} }
} }
clearTrigger("applyBatchAuto"); clearTrigger("applyBatchAuto");
const ret = await runWithLock("procFiles", false, async () => { const ret = await runWithLock("procFiles", true, async () => {
do {
const procs = [...this.watchedFileEventQueue]; const procs = [...this.watchedFileEventQueue];
this.watchedFileEventQueue = []; this.watchedFileEventQueue = [];
for (const queue of procs) { for (const queue of procs) {
@@ -877,6 +878,8 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
} }
} }
this.refreshStatusText(); this.refreshStatusText();
} while (this.watchedFileEventQueue.length != 0);
return true;
}) })
this.refreshStatusText(); this.refreshStatusText();
return ret; return ret;
@@ -917,8 +920,10 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
} }
async applyBatchChange() { async applyBatchChange() {
if (this.settings.batchSave) {
return await this.procFileEvent(true); return await this.procFileEvent(true);
} }
}
// Watch raw events (Internal API) // Watch raw events (Internal API)
watchVaultRawEvents(path: string) { watchVaultRawEvents(path: string) {