From 647f23634de22ef10dc949bbb89aa27f8ed43d2c Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Wed, 9 Aug 2023 17:52:39 +0200 Subject: [PATCH] More sync debugging --- web/sync_service.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/sync_service.ts b/web/sync_service.ts index 6e742809..ed74ba1e 100644 --- a/web/sync_service.ts +++ b/web/sync_service.ts @@ -143,6 +143,7 @@ export class SyncService { // Not completely safe, could have race condition on setting the syncStartTimeKey const startTime = Date.now(); while (await this.isSyncing()) { + console.log("Waiting for ongoing sync to finish..."); await sleep(321); if (Date.now() - startTime > timeout) { throw new Error("Timeout waiting for sync to finish"); @@ -210,15 +211,17 @@ export class SyncService { // Syncs a single file async syncFile(name: string) { + console.log("About to sync file", name); if (!this.isSyncCandidate(name)) { + console.log("Info not a sync candidate", name); return; } if (await this.isSyncing()) { console.log("Already syncing, aborting individual file sync for", name); return; } - await this.registerSyncStart(false); console.log("Syncing file", name); + await this.registerSyncStart(false); const snapshot = await this.getSnapshot(); try { let localHash: number | undefined; @@ -256,6 +259,7 @@ export class SyncService { } await this.saveSnapshot(snapshot); await this.registerSyncStop(); + console.log("And done with file sync for", name); } async saveSnapshot(snapshot: Map) {