From 7f6fe8a582e96da99616c5a6f41baebb20302d4a Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sun, 16 Mar 2025 20:01:43 +0000 Subject: [PATCH] Fixes --- frontend/obsidian-plugin/webpack.config.js | 3 --- .../sync-client/src/services/sync-service.ts | 2 +- .../src/sync-operations/unrestricted-syncer.ts | 10 +++++++--- frontend/sync-client/webpack.config.js | 3 +-- frontend/test-client/src/cli.ts | 18 ++++++++---------- 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/frontend/obsidian-plugin/webpack.config.js b/frontend/obsidian-plugin/webpack.config.js index 66c35d63..75c87fb7 100644 --- a/frontend/obsidian-plugin/webpack.config.js +++ b/frontend/obsidian-plugin/webpack.config.js @@ -94,9 +94,6 @@ module.exports = (env, argv) => ({ alias: { root: __dirname, src: path.resolve(__dirname, "src") - }, - fallback: { - url: require.resolve("url") } }, output: { diff --git a/frontend/sync-client/src/services/sync-service.ts b/frontend/sync-client/src/services/sync-service.ts index 92455643..74954cf3 100644 --- a/frontend/sync-client/src/services/sync-service.ts +++ b/frontend/sync-client/src/services/sync-service.ts @@ -112,7 +112,7 @@ export class SyncService { contentBytes: Uint8Array; }): Promise { this.logger.debug( - `Updating document ${documentId} with parent version ${parentVersionId} & ${new TextDecoder().decode(contentBytes)} & ${relativePath}` + `Updating document ${documentId} with parent version ${parentVersionId} and relative path ${relativePath}` ); const formData = new FormData(); formData.append("parent_version_id", parentVersionId.toString()); diff --git a/frontend/sync-client/src/sync-operations/unrestricted-syncer.ts b/frontend/sync-client/src/sync-operations/unrestricted-syncer.ts index e38af28c..fe268f4d 100644 --- a/frontend/sync-client/src/sync-operations/unrestricted-syncer.ts +++ b/frontend/sync-client/src/sync-operations/unrestricted-syncer.ts @@ -105,9 +105,11 @@ export class UnrestrictedSyncer { public async unrestrictedSyncLocallyUpdatedFile({ oldPath, - document + document, + force = false }: { oldPath?: RelativePath; + force?: boolean; document: DocumentRecord; }): Promise { await this.executeSync( @@ -131,7 +133,8 @@ export class UnrestrictedSyncer { if ( document.metadata.hash === contentHash && - oldPath === undefined + oldPath === undefined && + !force ) { this.logger.debug( `File hash of ${document.relativePath} matches with last synced version and the path hasn't changed; no need to sync` @@ -270,7 +273,8 @@ export class UnrestrictedSyncer { } return this.unrestrictedSyncLocallyUpdatedFile({ - document + document, + force: true }); } else if (remoteVersion.isDeleted) { // Either the doc hasn't made it to us before and therefore we don't need to delete it, diff --git a/frontend/sync-client/webpack.config.js b/frontend/sync-client/webpack.config.js index 609d2533..3f913041 100644 --- a/frontend/sync-client/webpack.config.js +++ b/frontend/sync-client/webpack.config.js @@ -39,8 +39,7 @@ module.exports = [ filename: "sync-client.web.js", library: { name: "SyncClient", - type: "umd", - export: "default" + type: "umd" }, globalObject: "this" } diff --git a/frontend/test-client/src/cli.ts b/frontend/test-client/src/cli.ts index 326ebb99..ea7ebbd0 100644 --- a/frontend/test-client/src/cli.ts +++ b/frontend/test-client/src/cli.ts @@ -111,16 +111,14 @@ async function runTests(): Promise { 1 // test with concurrency 1 to check for deadlocks ]) { for (const doDeletes of [true, false]) { - for (let i = 0; i < 4; i++) { - await runTest({ - agentCount: 2, - concurrency, - iterations: 200, - doDeletes, - useSlowFileEvents, - jitterScaleInSeconds: 0.75 - }); - } + await runTest({ + agentCount: 3, + concurrency, + iterations: 100, + doDeletes, + useSlowFileEvents, + jitterScaleInSeconds: 0.75 + }); } } }