From df11fb12ce4e767da564647601ba85cc223102c6 Mon Sep 17 00:00:00 2001 From: Bobby Wibowo Date: Thu, 28 May 2020 23:10:56 +0700 Subject: [PATCH] Fixed racing condition in initial dirs creation Fixed #190 --- controllers/pathsController.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/controllers/pathsController.js b/controllers/pathsController.js index c86e000..090dc6c 100644 --- a/controllers/pathsController.js +++ b/controllers/pathsController.js @@ -51,7 +51,7 @@ const verify = [ self.init = async () => { // Check & create directories - await Promise.all(verify.map(async p => { + for (const p of verify) try { await self.access(p) } catch (err) { @@ -63,7 +63,6 @@ self.init = async () => { logger.log(`Created directory: ${p}`) } } - })) // Purge any leftover in chunks directory const uuidDirs = await self.readdir(self.chunks)