Try to slow down upload cache

This commit is contained in:
Alex Rodionov 2023-01-10 16:20:36 -08:00
parent 0753213107
commit 74154140df
8 changed files with 473 additions and 218 deletions

View file

@ -1,4 +1,5 @@
const fs = require('fs')
const { setTimeout } = require('node:timers/promises')
const core = require('@actions/core')
const cache = require('@actions/cache')
const github = require('@actions/github')
@ -88,7 +89,13 @@ async function restoreCache (cacheConfig) {
console.log(`Attempting to restore ${name} cache from ${key}`)
const restoredKey = await cache.restoreCache(paths, key, [restoreKey])
const restoredKey = await setTimeout(1000, async function() {
return await cache.restoreCache(
paths, key, [restoreKey],
{ segmentTimeoutInMs: 300000 } // 5 minutes
)
}())
if (restoredKey) {
console.log(`Successfully restored cache from ${restoredKey}`)