diff --git a/index.js b/index.js index 79eba2f..9c6ec7b 100644 --- a/index.js +++ b/index.js @@ -197,11 +197,12 @@ fs.readdirSync(process.env.CONFIG_PATH).forEach(file => { break; } }) - +var check; const watchFiles = () => { fs.watch(process.env.CONFIG_PATH, (event, file) => { + clearTimeout(check); // Debounce if (file.startsWith(".")) return; // Ignore hidden files - setTimeout(() => { + check = setTimeout(() => { tmp = {} newContents = fs.readFileSync(path.join(process.env.CONFIG_PATH, file)).toString() switch (file) {