only create one timeout

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

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

Loading…
Cancel
Save