From 7bc9edaaedec9e12a4ee321e3e703528d638d20d Mon Sep 17 00:00:00 2001 From: Mark Molinaro Date: Thu, 14 Apr 2022 06:35:44 +0000 Subject: [PATCH 1/3] Respect fs_accuracy when determining if file is untouched --- lib/DirectoryWatcher.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/DirectoryWatcher.js b/lib/DirectoryWatcher.js index 5cf3a47..566048d 100644 --- a/lib/DirectoryWatcher.js +++ b/lib/DirectoryWatcher.js @@ -12,7 +12,7 @@ const watchEventSource = require("./watchEventSource"); const EXISTANCE_ONLY_TIME_ENTRY = Object.freeze({}); -let FS_ACCURACY = 1000; +let FS_ACCURACY = 2000; const IS_OSX = require("os").platform() === "darwin"; const WATCHPACK_POLLING = process.env.WATCHPACK_POLLING; @@ -181,7 +181,7 @@ class DirectoryWatcher extends EventEmitter { safeTime = now; accuracy = 0; - if (old && old.timestamp === mtime && mtime + FS_ACCURACY < now - 1000) { + if (old && old.timestamp === mtime && mtime + 2 * FS_ACCURACY < now) { // We are sure that mtime is untouched // This can be caused by some file attribute change // e. g. when access time has been changed @@ -782,4 +782,5 @@ function ensureFsAccuracy(mtime) { if (FS_ACCURACY > 1 && mtime % 1 !== 0) FS_ACCURACY = 1; else if (FS_ACCURACY > 10 && mtime % 10 !== 0) FS_ACCURACY = 10; else if (FS_ACCURACY > 100 && mtime % 100 !== 0) FS_ACCURACY = 100; + else if (FS_ACCURACY > 1000 && mtime % 1000 !== 0) FS_ACCURACY = 1000; } From 52fbd7a4be7995f2a10ff0096b26435514014912 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Tue, 19 Apr 2022 11:10:29 +0200 Subject: [PATCH 2/3] revert FS_ACCURACY default change --- lib/DirectoryWatcher.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/DirectoryWatcher.js b/lib/DirectoryWatcher.js index 566048d..bd4ce39 100644 --- a/lib/DirectoryWatcher.js +++ b/lib/DirectoryWatcher.js @@ -12,7 +12,7 @@ const watchEventSource = require("./watchEventSource"); const EXISTANCE_ONLY_TIME_ENTRY = Object.freeze({}); -let FS_ACCURACY = 2000; +let FS_ACCURACY = 1000; const IS_OSX = require("os").platform() === "darwin"; const WATCHPACK_POLLING = process.env.WATCHPACK_POLLING; @@ -782,5 +782,4 @@ function ensureFsAccuracy(mtime) { if (FS_ACCURACY > 1 && mtime % 1 !== 0) FS_ACCURACY = 1; else if (FS_ACCURACY > 10 && mtime % 10 !== 0) FS_ACCURACY = 10; else if (FS_ACCURACY > 100 && mtime % 100 !== 0) FS_ACCURACY = 100; - else if (FS_ACCURACY > 1000 && mtime % 1000 !== 0) FS_ACCURACY = 1000; } From 538654fae479164b77c437fd239d3ef81ae07c8a Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Tue, 19 Apr 2022 11:10:55 +0200 Subject: [PATCH 3/3] remove double FS_ACCURACY distance --- lib/DirectoryWatcher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/DirectoryWatcher.js b/lib/DirectoryWatcher.js index bd4ce39..e982f0c 100644 --- a/lib/DirectoryWatcher.js +++ b/lib/DirectoryWatcher.js @@ -181,7 +181,7 @@ class DirectoryWatcher extends EventEmitter { safeTime = now; accuracy = 0; - if (old && old.timestamp === mtime && mtime + 2 * FS_ACCURACY < now) { + if (old && old.timestamp === mtime && mtime + FS_ACCURACY < now) { // We are sure that mtime is untouched // This can be caused by some file attribute change // e. g. when access time has been changed