Compare commits
2 Commits
8bdab1f9db
...
aeb0368508
| Author | SHA1 | Date | |
|---|---|---|---|
| aeb0368508 | |||
| 106ed777fa |
@@ -25,7 +25,7 @@ async function ghActionBot() {
|
||||
PULL_LABEL_FILTER,
|
||||
PULL_AUTHOR_FILTER,
|
||||
PULL_RETEST_BODY,
|
||||
ACTION_RETRY_DELAY = 3000,
|
||||
ACTION_CHECK_DELAY = 3000,
|
||||
} = process.env;
|
||||
|
||||
// load the history module
|
||||
@@ -100,7 +100,7 @@ async function ghActionBot() {
|
||||
logger.debug(`CHECK #${record.pull.number}: verify state change`);
|
||||
|
||||
// wait for the ci to restart
|
||||
await sleep(ACTION_RETRY_DELAY);
|
||||
await sleep(ACTION_CHECK_DELAY);
|
||||
|
||||
// check that the commit status is now pending
|
||||
const buildStatus = await getCommitStatus(repo, record.commit.sha);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default async function execAndCheck(fn, test, onFailure = () => {}) {
|
||||
export default async function execAndCheck(fn, test, onFailure = () => {}, opts = { tries: 3 }) {
|
||||
let count = 0;
|
||||
|
||||
const tryExec = async () => {
|
||||
@@ -9,11 +9,9 @@ export default async function execAndCheck(fn, test, onFailure = () => {}) {
|
||||
const res = await test();
|
||||
if (res) return;
|
||||
|
||||
const { ACTION_RETRY_COUNT = 3 } = process.env;
|
||||
|
||||
// if retry limit is hit, call failure function
|
||||
count += 1;
|
||||
if (count >= ACTION_RETRY_COUNT) return onFailure(); // eslint-disable-line consistent-return
|
||||
if (count >= opts.tries) return onFailure(); // eslint-disable-line consistent-return
|
||||
|
||||
// retry the function and retest the results
|
||||
return tryExec(); // eslint-disable-line consistent-return
|
||||
|
||||
Reference in New Issue
Block a user