Skip to content

Commit

Permalink
fix: correctly flush cache
Browse files Browse the repository at this point in the history
  • Loading branch information
wessberg committed Sep 24, 2021
1 parent cc1314a commit f1fcdfe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/constant/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const tempRoot = join(
);

export const constant: IConstant = {
cacheVersion: 1,
cacheVersion: 2,
endpoint: {
index: "/api",
polyfill: "/api/polyfill"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,11 @@ export class CacheRegistryService implements ICacheRegistryService {
const lastCachedConfigChecksum = await this.getLastCachedPolyfillConfigChecksum();

// If the config changed, the disk cache needs to be flushed
if (lastCachedConfigChecksum !== getPolyfillConfigChecksum()) return false;
if (lastCachedConfigChecksum !== getPolyfillConfigChecksum()) {
this.logger.debug(`The checksum for the config changed! Flushing cache...`);
await this.flushCache();
return false;
}

for (const [polyfillName, polyfill] of Object.entries(constant.polyfill)) {
// Skip aliases
Expand Down

0 comments on commit f1fcdfe

Please sign in to comment.