From 7c4c8226cb2f642c1e4d7a3a6add9b9065454986 Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 15 May 2024 19:20:28 -0400 Subject: [PATCH] fix: don't start multiple runners during RequestLimitExceeded (#6444) Oddly, there was multiple runners stemming from requests that returned RequestLimitExceeded. Let's add a check if an instance popped up. --- .github/spot-runner-action/dist/index.js | 5 ++++- .github/spot-runner-action/src/main.ts | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/spot-runner-action/dist/index.js b/.github/spot-runner-action/dist/index.js index 1b271e11402..b34f8c07dc9 100644 --- a/.github/spot-runner-action/dist/index.js +++ b/.github/spot-runner-action/dist/index.js @@ -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); @@ -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; } } diff --git a/.github/spot-runner-action/src/main.ts b/.github/spot-runner-action/src/main.ts index 52e4f9e6b3b..7b7173f5795 100644 --- a/.github/spot-runner-action/src/main.ts +++ b/.github/spot-runner-action/src/main.ts @@ -88,9 +88,11 @@ async function requestAndWaitForSpot(config: ActionConfig): Promise { // 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; } }