Skip to content

Commit a54bcdb

Browse files
authored
Merge pull request #215 from markjm/markjm/repsect-fs-accuracy
Respect FS_ACCURACY when determining if file is untouched
2 parents 15ac38f + 3e59650 commit a54bcdb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/DirectoryWatcher.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const watchEventSource = require("./watchEventSource");
1212

1313
const EXISTANCE_ONLY_TIME_ENTRY = Object.freeze({});
1414

15-
let FS_ACCURACY = 1000;
15+
let FS_ACCURACY = 2000;
1616

1717
const IS_OSX = require("os").platform() === "darwin";
1818
const WATCHPACK_POLLING = process.env.WATCHPACK_POLLING;
@@ -181,7 +181,7 @@ class DirectoryWatcher extends EventEmitter {
181181
safeTime = now;
182182
accuracy = 0;
183183

184-
if (old && old.timestamp === mtime && mtime + FS_ACCURACY < now - 1000) {
184+
if (old && old.timestamp === mtime && mtime + FS_ACCURACY < now) {
185185
// We are sure that mtime is untouched
186186
// This can be caused by some file attribute change
187187
// e. g. when access time has been changed
@@ -782,4 +782,5 @@ function ensureFsAccuracy(mtime) {
782782
if (FS_ACCURACY > 1 && mtime % 1 !== 0) FS_ACCURACY = 1;
783783
else if (FS_ACCURACY > 10 && mtime % 10 !== 0) FS_ACCURACY = 10;
784784
else if (FS_ACCURACY > 100 && mtime % 100 !== 0) FS_ACCURACY = 100;
785+
else if (FS_ACCURACY > 1000 && mtime % 1000 !== 0) FS_ACCURACY = 1000;
785786
}

0 commit comments

Comments
 (0)