Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[No QA] Add delay to promise while, log poll rate #40885

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {promiseDoWhile} from '@github/libs/promiseWhile';
type CurrentStagingDeploys = Awaited<ReturnType<typeof GitHubUtils.octokit.actions.listWorkflowRuns>>['data']['workflow_runs'];

function run() {
console.info('[awaitStagingDeploys] POLL RATE', CONST.POLL_RATE);
console.info('[awaitStagingDeploys] run()');
console.info('[awaitStagingDeploys] getStringInput', getStringInput);
console.info('[awaitStagingDeploys] GitHubUtils', GitHubUtils);
Expand Down
8 changes: 7 additions & 1 deletion .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12131,6 +12131,7 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873));
const GithubUtils_1 = __importDefault(__nccwpck_require__(9296));
const promiseWhile_1 = __nccwpck_require__(9438);
function run() {
console.info('[awaitStagingDeploys] POLL RATE', CONST_1.default.POLL_RATE);
console.info('[awaitStagingDeploys] run()');
console.info('[awaitStagingDeploys] getStringInput', ActionUtils_1.getStringInput);
console.info('[awaitStagingDeploys] GitHubUtils', GithubUtils_1.default);
Expand Down Expand Up @@ -12742,7 +12743,12 @@ function promiseWhile(condition, action) {
resolve();
return;
}
Promise.resolve(actionResult).then(loop).catch(reject);
Promise.resolve(actionResult)
.then(() => {
// Set a timeout to delay the next loop iteration
setTimeout(loop, 1000); // 1000 ms delay
})
.catch(reject);
}
};
loop();
Expand Down
7 changes: 6 additions & 1 deletion .github/libs/promiseWhile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ function promiseWhile(condition: () => boolean, action: (() => Promise<void>) |
return;
}

Promise.resolve(actionResult).then(loop).catch(reject);
Promise.resolve(actionResult)
.then(() => {
// Set a timeout to delay the next loop iteration
setTimeout(loop, 1000); // 1000 ms delay
})
.catch(reject);
}
};
loop();
Expand Down
Loading