Fixes
This commit is contained in:
parent
10568efebe
commit
7f6fe8a582
5 changed files with 17 additions and 19 deletions
|
|
@ -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: {
|
||||||
|
|
|
||||||
|
|
@ -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());
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue