Skip to content

Commit

Permalink
fix(cache): cache checksum for config and flush cache if the config c…
Browse files Browse the repository at this point in the history
…hanged
  • Loading branch information
wessberg committed Oct 23, 2020
1 parent 632989a commit a5e818e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/service/registry/cache-registry/cache-registry-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ export class CacheRegistryService implements ICacheRegistryService {
* Returns true if the given polyfill name needs an update within the cache
*/
async needsUpdate(polyfillName: PolyfillName, currentVersion: string): Promise<boolean> {
const configChecksum = await this.getLastCachedPolyfillConfigChecksum();
if (configChecksum !== getPolyfillConfigChecksum()) return true;

const packageVersionMap = await this.getPackageVersionMap();
const cachedVersion = packageVersionMap[polyfillName];

Expand Down Expand Up @@ -163,6 +160,9 @@ export class CacheRegistryService implements ICacheRegistryService {
* If 'true' is returned, the cache is valid
*/
private async validateDiskCache(): Promise<boolean> {
const lastCachedConfigChecksum = await this.getLastCachedPolyfillConfigChecksum();
if (lastCachedConfigChecksum !== getPolyfillConfigChecksum()) return true;

for (const [polyfillName, polyfill] of Object.entries(constant.polyfill)) {
// Skip aliases
if ("polyfills" in polyfill) continue;
Expand Down

0 comments on commit a5e818e

Please sign in to comment.