Add small delay

This commit is contained in:
Alex Rodionov 2023-01-11 17:00:47 -08:00
parent 3c0903ad5b
commit d7374da072
3 changed files with 55 additions and 39 deletions

12
dist/main/index.js vendored
View file

@ -66189,6 +66189,14 @@ module.exports = require("timers");
/***/ }),
/***/ 8670:
/***/ ((module) => {
"use strict";
module.exports = require("timers/promises");
/***/ }),
/***/ 4404:
/***/ ((module) => {
@ -74617,6 +74625,7 @@ var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
const fs = __nccwpck_require__(7147)
const { setTimeout } = __nccwpck_require__(8670)
const core = __nccwpck_require__(2186)
const cache = __nccwpck_require__(7799)
const glob = __nccwpck_require__(8090)
@ -74688,6 +74697,8 @@ async function restoreCache (cacheConfig) {
return
}
const delay = Math.random() * 1000 // timeout <= 1 sec to reduce 429 errors
await setTimeout(delay, async function () {
core.startGroup(`Restore cache for ${cacheConfig.name}`)
const hash = await glob.hashFiles(cacheConfig.files.join('\n'))
@ -74714,6 +74725,7 @@ async function restoreCache (cacheConfig) {
}
core.endGroup()
}())
}
run()

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,5 @@
const fs = require('fs')
const { setTimeout } = require('timers/promises')
const core = require('@actions/core')
const cache = require('@actions/cache')
const glob = require('@actions/glob')
@ -70,6 +71,8 @@ async function restoreCache (cacheConfig) {
return
}
const delay = Math.random() * 1000 // timeout <= 1 sec to reduce 429 errors
await setTimeout(delay, async function () {
core.startGroup(`Restore cache for ${cacheConfig.name}`)
const hash = await glob.hashFiles(cacheConfig.files.join('\n'))
@ -96,6 +99,7 @@ async function restoreCache (cacheConfig) {
}
core.endGroup()
}())
}
run()