mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Ignore meaningless initial fs.watchFile callback.
As a reminder, we use fs.watchFile only as a fallback in environments where pathwatcher.watch is not available, such as on network or virtual file systems.
This commit is contained in:
@@ -36,7 +36,7 @@ function acquireWatcher(absPath, callback) {
|
||||
}
|
||||
|
||||
function startNewWatcher(absPath) {
|
||||
let lastPathwatcherEventTime = 0;
|
||||
let lastPathwatcherEventTime = +new Date;
|
||||
const callbacks = new Set;
|
||||
let latestHash = hashOrNull(absPath);
|
||||
let watcherCleanupTimer = null;
|
||||
@@ -72,7 +72,16 @@ function startNewWatcher(absPath) {
|
||||
: NO_PATHWATCHER_POLLING_INTERVAL;
|
||||
|
||||
function watchFileWrapper(...args) {
|
||||
const self = this;
|
||||
const [newStat, oldStat] = args;
|
||||
|
||||
if (newStat.ino === 0 &&
|
||||
oldStat.ino === 0 &&
|
||||
+newStat.mtime === +oldStat.mtime) {
|
||||
// Node calls the watchFile listener once with bogus identical stat
|
||||
// objects, which should not trigger a file change event.
|
||||
return;
|
||||
}
|
||||
|
||||
// If a pathwatcher event fired in the last polling interval, ignore
|
||||
// this event.
|
||||
if (new Date - lastPathwatcherEventTime > pollingInterval) {
|
||||
|
||||
Reference in New Issue
Block a user