fix: handle 429 api rate error

This commit is contained in:
alon.dotan 2024-09-23 11:56:48 +03:00
parent 1670d14080
commit 3a265b5c1d

View file

@ -195,8 +195,19 @@ export async function saveCache() {
for (const cachePath of cachePaths) { for (const cachePath of cachePaths) {
core.debug(`- ${cachePath}`); core.debug(`- ${cachePath}`);
} }
for (let i = 1; i <= 10; i++) {
await cache.saveCache(cachePaths, primaryKey); try {
return await cache.saveCache(cachePaths, primaryKey);
}
catch(error) {
const errStr = `${error}`
if (errStr.includes("Cache service responded with 429 during upload chunk")) {
core.info('Failed to upload cache, got rate limit error, waiting 30 seconds.');
await new Promise(f => setTimeout(f, 30000));
}
}
}
throw Error("Failed to upload cache.")
} }
export async function restoreCache() { export async function restoreCache() {