Skip to content

Commit 9cce895

Browse files
committed
Fix: ENOENT: no such file or directory, scandir 'image-layers'
ENOENT: no such file or directory, scandir '/home/runner/work/action-docker-layer-caching/action-docker-layer-caching/.action-docker-layer-caching-docker_images/image-layers'
1 parent 5ffbffb commit 9cce895

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/LayerCache.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,19 @@ class LayerCache {
179179
private async restoreLayers(): Promise<boolean> {
180180
const pool = new PromisePool(this.concurrency)
181181

182+
const tasks = (await this.getLayerIds()).map(
183+
layerId => pool.open(() => this.restoreSingleLayerBy(layerId))
184+
)
185+
182186
try {
183-
await (await this.getLayerIds()).map(
184-
layerId => {
185-
return pool.open(() => this.restoreSingleLayerBy(layerId))
186-
}
187-
)
187+
await Promise.all(tasks)
188188
} catch (e) {
189189
if (typeof e.message === `string` && e.message.includes(LayerCache.ERROR_LAYER_CACHE_NOT_FOUND_STR)) {
190190
core.info(e.message)
191+
192+
// Avoid UnhandledPromiseRejectionWarning
193+
tasks.map(task => task.catch(core.info))
194+
191195
return false
192196
}
193197
throw e
@@ -280,7 +284,7 @@ class LayerCache {
280284

281285
async recoverUnformattedSaveKey() {
282286
const hash = await loadRawManifests(this.getUnpackedTarDir())
283-
return this.restoredRootKey.replace(hash, `{hash}`)
287+
return this.restoredRootKey.replace(hash, `{hash}`).replace(/-root$/, ``)
284288
}
285289

286290
async getLayerTarFiles(): Promise<string[]> {

0 commit comments

Comments
 (0)