only create one timeout

pull/15950/head
Rich Harris 4 months ago
parent 36c74becc1
commit e10ea8a169

@ -420,11 +420,13 @@ function run() {
if (watch) { if (watch) {
let running = false; let running = false;
let timeout;
fs.watch('messages', { recursive: true }, (type, file) => { fs.watch('messages', { recursive: true }, (type, file) => {
if (running) { if (running) {
setTimeout(() => { timeout ??= setTimeout(() => {
running = false; running = false;
timeout = null;
}); });
} else { } else {
running = true; running = true;

Loading…
Cancel
Save