From 40afa7a420b5886361248277fdfaca6d4d485032 Mon Sep 17 00:00:00 2001 From: softsimon Date: Thu, 16 Jul 2020 00:55:41 +0700 Subject: [PATCH] Remove filename check for fs.watch --- backend/src/api/bisq.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/backend/src/api/bisq.ts b/backend/src/api/bisq.ts index 7792a567b..2013e4365 100644 --- a/backend/src/api/bisq.ts +++ b/backend/src/api/bisq.ts @@ -28,15 +28,13 @@ class Bisq { let fsWait: NodeJS.Timeout | null = null; fs.watch(config.BSQ_BLOCKS_DATA_PATH, (event: string, filename: string) => { - if (filename) { - if (fsWait) { - clearTimeout(fsWait); - } - fsWait = setTimeout(() => { - console.log(`${filename} file change detected.`); - this.loadBisqDumpFile(); - }, 1000); + if (fsWait) { + clearTimeout(fsWait); } + fsWait = setTimeout(() => { + console.log(`${filename} file change detected.`); + this.loadBisqDumpFile(); + }, 1000); }); setInterval(this.updatePrice.bind(this), 1000 * 60 * 60);