Various improvements #169
1 changed files with 4 additions and 4 deletions
Fix race condition
commit
4740cb958b
|
|
@ -412,7 +412,7 @@ export class Syncer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const updates = awaitAll(
|
await awaitAll(
|
||||||
allLocalFiles.map(async (relativePath) => {
|
allLocalFiles.map(async (relativePath) => {
|
||||||
if (
|
if (
|
||||||
this.database.getLatestDocumentByRelativePath(relativePath)
|
this.database.getLatestDocumentByRelativePath(relativePath)
|
||||||
|
|
@ -470,7 +470,9 @@ export class Syncer {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const deletes = awaitAll(
|
// this has to happen strictly after the previous awaitAll, as that one
|
||||||
|
// might have removed some of the documents from the list
|
||||||
|
await awaitAll(
|
||||||
locallyPossiblyDeletedFiles.map(async ({ relativePath }) => {
|
locallyPossiblyDeletedFiles.map(async ({ relativePath }) => {
|
||||||
this.logger.debug(
|
this.logger.debug(
|
||||||
`Document ${relativePath} has been deleted locally, scheduling sync to delete it`
|
`Document ${relativePath} has been deleted locally, scheduling sync to delete it`
|
||||||
|
|
@ -480,8 +482,6 @@ export class Syncer {
|
||||||
return this.syncLocallyDeletedFile(relativePath);
|
return this.syncLocallyDeletedFile(relativePath);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
await awaitAll([updates, deletes]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue