@@ -167,21 +167,19 @@ export class OperationBuildCache {
167167
168168 let localCacheEntryPath : string | undefined =
169169 await this . _localBuildCacheProvider . tryGetCacheEntryPathByIdAsync ( terminal , cacheId ) ;
170- let cacheEntryBuffer : Buffer | undefined ;
170+ let cloudCacheHit : boolean = false ;
171171 let updateLocalCacheSuccess : boolean | undefined ;
172172 if ( ! localCacheEntryPath && this . _cloudBuildCacheProvider ) {
173173 terminal . writeVerboseLine (
174174 'This project was not found in the local build cache. Querying the cloud build cache.'
175175 ) ;
176176
177- if (
178- this . _useStreamingBuildCache &&
179- this . _cloudBuildCacheProvider . tryGetCacheEntryStreamByIdAsync
180- ) {
177+ if ( this . _useStreamingBuildCache && this . _cloudBuildCacheProvider . tryGetCacheEntryStreamByIdAsync ) {
181178 // Use streaming path to avoid loading the entire cache entry into memory
182179 const cacheEntryStream : NodeJS . ReadableStream | undefined =
183180 await this . _cloudBuildCacheProvider . tryGetCacheEntryStreamByIdAsync ( terminal , cacheId ) ;
184181 if ( cacheEntryStream ) {
182+ cloudCacheHit = true ;
185183 try {
186184 localCacheEntryPath = await this . _localBuildCacheProvider . trySetCacheEntryStreamAsync (
187185 terminal ,
@@ -195,11 +193,10 @@ export class OperationBuildCache {
195193 }
196194 }
197195 } else {
198- cacheEntryBuffer = await this . _cloudBuildCacheProvider . tryGetCacheEntryBufferByIdAsync (
199- terminal ,
200- cacheId
201- ) ;
196+ const cacheEntryBuffer : Buffer | undefined =
197+ await this . _cloudBuildCacheProvider . tryGetCacheEntryBufferByIdAsync ( terminal , cacheId ) ;
202198 if ( cacheEntryBuffer ) {
199+ cloudCacheHit = true ;
203200 try {
204201 localCacheEntryPath = await this . _localBuildCacheProvider . trySetCacheEntryBufferAsync (
205202 terminal ,
@@ -215,7 +212,7 @@ export class OperationBuildCache {
215212 }
216213 }
217214
218- if ( ! localCacheEntryPath && ! cacheEntryBuffer ) {
215+ if ( ! localCacheEntryPath && ! cloudCacheHit ) {
219216 terminal . writeVerboseLine ( 'This project was not found in the build cache.' ) ;
220217 return false ;
221218 }
@@ -349,10 +346,7 @@ export class OperationBuildCache {
349346 throw new InternalError ( 'Expected the local cache entry path to be set.' ) ;
350347 }
351348
352- if (
353- this . _useStreamingBuildCache &&
354- this . _cloudBuildCacheProvider . trySetCacheEntryStreamAsync
355- ) {
349+ if ( this . _useStreamingBuildCache && this . _cloudBuildCacheProvider . trySetCacheEntryStreamAsync ) {
356350 // Use streaming upload to avoid loading the entire cache entry into memory
357351 const entryStream : FileSystemReadStream = FileSystem . createReadStream ( localCacheEntryPath ) ;
358352 setCloudCacheEntryPromise = this . _cloudBuildCacheProvider
0 commit comments