Hold off on using optimistic functions in watch.readAndWatchFileWithHash.

This partially reverts commit 96c95629eb.

When running `meteor update`, we call writeReleaseFileAndDevBundleLink
immediately before reading .meteor/release, so there's no time for a file
change notification to invalidate the cached contents of that file.

In the future, we could perhaps call optimisticReadFile.dirty(path) as a
consequence of files.writeFile(path, ...), but that may be tricky.
This commit is contained in:
Ben Newman
2016-10-11 11:23:31 -04:00
parent c8c4686588
commit 1d375ffb70

View File

@@ -7,7 +7,6 @@ import {Profile} from '../tool-env/profile.js';
import {
optimisticStatOrNull,
optimisticReadFile,
optimisticReaddir,
optimisticHashOrNull,
} from "./optimistic.js";
@@ -247,7 +246,7 @@ export class WatchSet {
export function readFile(absPath) {
try {
return optimisticReadFile(absPath);
return files.readFile(absPath);
} catch (e) {
// Rethrow most errors.
if (! e || (e.code !== 'ENOENT' && e.code !== 'EISDIR')) {
@@ -732,7 +731,7 @@ export function readAndWatchFileWithHash(watchSet, absPath) {
// context where we might not always have a WatchSet (eg, reading
// settings.json where we watch for "meteor run" but not for "meteor deploy").
if (watchSet) {
hash = optimisticHashOrNull(absPath);
hash = contents === null ? null : sha1(contents);
watchSet.addFile(absPath, hash);
}