This commit is contained in:
Andras Schmelczer 2025-03-16 20:01:43 +00:00
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: { alias: {
root: __dirname, root: __dirname,
src: path.resolve(__dirname, "src") src: path.resolve(__dirname, "src")
},
fallback: {
url: require.resolve("url")
} }
}, },
output: { output: {

View file

@ -112,7 +112,7 @@ export class SyncService {
contentBytes: Uint8Array; contentBytes: Uint8Array;
}): Promise<components["schemas"]["DocumentUpdateResponse"]> { }): Promise<components["schemas"]["DocumentUpdateResponse"]> {
this.logger.debug( 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(); const formData = new FormData();
formData.append("parent_version_id", parentVersionId.toString()); formData.append("parent_version_id", parentVersionId.toString());

View file

@ -105,9 +105,11 @@ export class UnrestrictedSyncer {
public async unrestrictedSyncLocallyUpdatedFile({ public async unrestrictedSyncLocallyUpdatedFile({
oldPath, oldPath,
document document,
force = false
}: { }: {
oldPath?: RelativePath; oldPath?: RelativePath;
force?: boolean;
document: DocumentRecord; document: DocumentRecord;
}): Promise<void> { }): Promise<void> {
await this.executeSync( await this.executeSync(
@ -131,7 +133,8 @@ export class UnrestrictedSyncer {
if ( if (
document.metadata.hash === contentHash && document.metadata.hash === contentHash &&
oldPath === undefined oldPath === undefined &&
!force
) { ) {
this.logger.debug( this.logger.debug(
`File hash of ${document.relativePath} matches with last synced version and the path hasn't changed; no need to sync` `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({ return this.unrestrictedSyncLocallyUpdatedFile({
document document,
force: true
}); });
} else if (remoteVersion.isDeleted) { } else if (remoteVersion.isDeleted) {
// Either the doc hasn't made it to us before and therefore we don't need to delete it, // 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", filename: "sync-client.web.js",
library: { library: {
name: "SyncClient", name: "SyncClient",
type: "umd", type: "umd"
export: "default"
}, },
globalObject: "this" globalObject: "this"
} }

View file

@ -111,11 +111,10 @@ async function runTests(): Promise<void> {
1 // test with concurrency 1 to check for deadlocks 1 // test with concurrency 1 to check for deadlocks
]) { ]) {
for (const doDeletes of [true, false]) { for (const doDeletes of [true, false]) {
for (let i = 0; i < 4; i++) {
await runTest({ await runTest({
agentCount: 2, agentCount: 3,
concurrency, concurrency,
iterations: 200, iterations: 100,
doDeletes, doDeletes,
useSlowFileEvents, useSlowFileEvents,
jitterScaleInSeconds: 0.75 jitterScaleInSeconds: 0.75
@ -124,7 +123,6 @@ async function runTests(): Promise<void> {
} }
} }
} }
}
process.on("uncaughtException", (error) => { process.on("uncaughtException", (error) => {
if (slowFileEvents) { if (slowFileEvents) {