From f5e022b7311cb9730d085cc9e29c9278d29cc26e Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 25 Feb 2021 02:07:09 -0700 Subject: [PATCH] [dev/build_ts_refs] check that commit in outDirs matches mergeBase (#92513) --- .../ref_output_cache/ref_output_cache.ts | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/dev/typescript/ref_output_cache/ref_output_cache.ts b/src/dev/typescript/ref_output_cache/ref_output_cache.ts index 6f51243e47555b..ca69236a706d25 100644 --- a/src/dev/typescript/ref_output_cache/ref_output_cache.ts +++ b/src/dev/typescript/ref_output_cache/ref_output_cache.ts @@ -76,28 +76,28 @@ export class RefOutputCache { * written to the directory. */ async initCaches() { - const archive = - this.archives.get(this.mergeBase) ?? - (await this.archives.getFirstAvailable([ - this.mergeBase, - ...(await this.repo.getRecentShasFrom(this.mergeBase, 5)), - ])); - - if (!archive) { - return; - } - const outdatedOutDirs = ( await concurrentMap(100, this.outDirs, async (outDir) => ({ path: outDir, - outdated: !(await matchMergeBase(outDir, archive.sha)), + outdated: !(await matchMergeBase(outDir, this.mergeBase)), })) ) .filter((o) => o.outdated) .map((o) => o.path); if (!outdatedOutDirs.length) { - this.log.debug('all outDirs have the most recent cache'); + this.log.debug('all outDirs have a recent cache'); + return; + } + + const archive = + this.archives.get(this.mergeBase) ?? + (await this.archives.getFirstAvailable([ + this.mergeBase, + ...(await this.repo.getRecentShasFrom(this.mergeBase, 5)), + ])); + + if (!archive) { return; }