From 7316e85efb88f3d57aad3e10f7e9e91f6ee1e96b Mon Sep 17 00:00:00 2001 From: bordun Date: Sat, 21 Nov 2020 18:47:34 +0100 Subject: [PATCH] custom module: prevent reloading the module while the file is being written to --- CHANGELOG.md | 3 +++ src/server/custom-module.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5486a9d6..f167503e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## 1.7.3 +- bug fixes + - custom module: prevent reloading the module while the file is being written to + - widgets - encoder: add `ticks` property back diff --git a/src/server/custom-module.js b/src/server/custom-module.js index 96ec1961..f29664a2 100644 --- a/src/server/custom-module.js +++ b/src/server/custom-module.js @@ -65,7 +65,7 @@ class CustomModule { this.load() - this.watcher = chokidar.watch(this.filename).on('change', ()=>{ + this.watcher = chokidar.watch(this.filename, {awaitWriteFinish: {stabilityThreshold: 200}}).on('change', ()=>{ if (this.submodule) { console.log('(INFO) Submodule changed: ' + this.filename) this.parent.reload()