Fixed racing condition in initial dirs creation

Fixed #190
This commit is contained in:
Bobby Wibowo 2020-05-28 23:10:56 +07:00
parent 1431bd3d90
commit df11fb12ce
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF

View File

@ -51,7 +51,7 @@ const verify = [
self.init = async () => { self.init = async () => {
// Check & create directories // Check & create directories
await Promise.all(verify.map(async p => { for (const p of verify)
try { try {
await self.access(p) await self.access(p)
} catch (err) { } catch (err) {
@ -63,7 +63,6 @@ self.init = async () => {
logger.log(`Created directory: ${p}`) logger.log(`Created directory: ${p}`)
} }
} }
}))
// Purge any leftover in chunks directory // Purge any leftover in chunks directory
const uuidDirs = await self.readdir(self.chunks) const uuidDirs = await self.readdir(self.chunks)