This commit is contained in:
Andras Schmelczer 2025-03-16 20:01:43 +00:00
parent 10568efebe
commit 7f6fe8a582
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
5 changed files with 17 additions and 19 deletions

View file

@ -94,9 +94,6 @@ module.exports = (env, argv) => ({
alias: {
root: __dirname,
src: path.resolve(__dirname, "src")
},
fallback: {
url: require.resolve("url")
}
},
output: {

View file

@ -112,7 +112,7 @@ export class SyncService {
contentBytes: Uint8Array;
}): Promise<components["schemas"]["DocumentUpdateResponse"]> {
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());

View file

@ -105,9 +105,11 @@ export class UnrestrictedSyncer {
public async unrestrictedSyncLocallyUpdatedFile({
oldPath,
document
document,
force = false
}: {
oldPath?: RelativePath;
force?: boolean;
document: DocumentRecord;
}): Promise<void> {
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,

View file

@ -39,8 +39,7 @@ module.exports = [
filename: "sync-client.web.js",
library: {
name: "SyncClient",
type: "umd",
export: "default"
type: "umd"
},
globalObject: "this"
}

View file

@ -111,16 +111,14 @@ async function runTests(): Promise<void> {
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
});
}
}
}