Skip to content

Commit

Permalink
fix: don't start multiple runners during RequestLimitExceeded (AztecP…
Browse files Browse the repository at this point in the history
…rotocol#6444)

Oddly, there was multiple runners stemming from requests that returned
RequestLimitExceeded. Let's add a check if an instance popped up.
  • Loading branch information
ludamad authored May 15, 2024
1 parent b892eae commit 7c4c822
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/spot-runner-action/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ function pollSpotStatus(config, ec2Client, ghClient) {
});
}
function requestAndWaitForSpot(config) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
// subaction is 'start' or 'restart'estart'
const ec2Client = new ec2_1.Ec2Instance(config);
Expand Down Expand Up @@ -747,9 +748,11 @@ function requestAndWaitForSpot(config) {
// wait 10 seconds
yield new Promise((r) => setTimeout(r, 5000 * Math.pow(2, backoff)));
backoff += 1;
core.info("Polling to see if we somehow have an instance up");
instanceId = yield ((_a = ec2Client.getInstancesForTags("running")[0]) === null || _a === void 0 ? void 0 : _a.instanceId);
}
if (instanceId) {
core.info("Successfully requested instance with ID " + instanceId);
core.info("Successfully requested/found instance with ID " + instanceId);
break;
}
}
Expand Down
4 changes: 3 additions & 1 deletion .github/spot-runner-action/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ async function requestAndWaitForSpot(config: ActionConfig): Promise<string> {
// wait 10 seconds
await new Promise((r) => setTimeout(r, 5000 * 2 ** backoff));
backoff += 1;
core.info("Polling to see if we somehow have an instance up");
instanceId = await ec2Client.getInstancesForTags("running")[0]?.instanceId;
}
if (instanceId) {
core.info("Successfully requested instance with ID " + instanceId);
core.info("Successfully requested/found instance with ID " + instanceId);
break;
}
}
Expand Down

0 comments on commit 7c4c822

Please sign in to comment.