diff --git a/react-packager/src/node-haste/Module.js b/react-packager/src/node-haste/Module.js index 729c9b2d..b4479ee0 100644 --- a/react-packager/src/node-haste/Module.js +++ b/react-packager/src/node-haste/Module.js @@ -31,12 +31,6 @@ import type Cache from './Cache'; import type DependencyGraphHelpers from './DependencyGraph/DependencyGraphHelpers'; import type ModuleCache from './ModuleCache'; -/** - * If the global cache returns empty that many times, we give up using the - * global cache for that instance. This speeds up the build. - */ -const GLOBAL_CACHE_MAX_MISSES = 250; - type ReadResult = { code: string, dependencies?: ?Array, @@ -85,7 +79,6 @@ class Module { _readPromises: Map>; static _globalCacheRetries: number; - static _globalCacheMaxMisses: number; constructor({ file, @@ -272,8 +265,7 @@ class Module { ) { const globalCache = GlobalTransformCache.get(); const noMoreRetries = Module._globalCacheRetries <= 0; - const tooManyMisses = Module._globalCacheMaxMisses <= 0; - if (globalCache == null || noMoreRetries || tooManyMisses) { + if (globalCache == null || noMoreRetries) { this._transformCodeForCallback(cacheProps, callback); return; } @@ -292,19 +284,9 @@ class Module { } } if (globalCachedResult == null) { - --Module._globalCacheMaxMisses; - if (Module._globalCacheMaxMisses === 0) { - this._reporter.update({ - type: 'global_cache_disabled', - reason: 'too_many_misses', - }); - } this._transformAndStoreCodeGlobally(cacheProps, globalCache, callback); return; } - if (Module._globalCacheMaxMisses < GLOBAL_CACHE_MAX_MISSES) { - ++Module._globalCacheMaxMisses; - } callback(undefined, globalCachedResult); }); } @@ -404,7 +386,6 @@ class Module { } Module._globalCacheRetries = 4; -Module._globalCacheMaxMisses = GLOBAL_CACHE_MAX_MISSES; // use weak map to speed up hash creation of known objects const knownHashes = new WeakMap();