Skip to content

Commit 970406a

Browse files
committed
rename columns
1 parent 2882339 commit 970406a

File tree

1 file changed

+19
-14
lines changed
  • terraform-aws-github-runner/modules/runners/lambdas/runners/src/scale-runners

1 file changed

+19
-14
lines changed

terraform-aws-github-runner/modules/runners/lambdas/runners/src/scale-runners/scale-up-chron.ts

+19-14
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export async function scaleUpChron(): Promise<void> {
2525
const minAutoScaleupDelayMinutes = 30;
2626
// Only proactively scale up the jobs that have been queued for longer than normal
2727
queuedJobs = queuedJobs.filter((runner) => {
28-
return runner.min_queue_time_min >= minAutoScaleupDelayMinutes &&
28+
return runner.min_queue_time_minutes >= minAutoScaleupDelayMinutes &&
2929
runner.org === Config.Instance.scaleConfigOrg;
3030
});
3131

@@ -41,29 +41,34 @@ export async function scaleUpChron(): Promise<void> {
4141
return {
4242
"id": Math.floor(Math.random() * 100000000000000),
4343
"eventType": "workflow_job",
44-
"repositoryName": runner.full_repo.split('/')[1],
44+
"repositoryName": runner.repo,
4545
"repositoryOwner": runner.org,
46-
}
46+
"runnerLabels": [runner.runner_label],
47+
};
48+
});
49+
50+
if (!Config.Instance.scaleUpRecordQueueUrl) {
51+
throw new Error('scaleUpRecordQueueUrl is not set. Cannot send scale up requests');
4752
}
4853

49-
sqsSendMessages(metrics, queuedJobs, Config.Instance.scaleUpRecordQueueUrl);
54+
await sqsSendMessages(metrics, scaleUpRequests, Config.Instance.scaleUpRecordQueueUrl);
5055
}
5156

5257
class QueuedJobsForRunner {
5358
runner_label: string;
5459
org: string;
55-
full_repo: string;
60+
repo: string;
5661
num_queued_jobs: number;
57-
min_queue_time_min: number;
58-
max_queue_time_min: number;
62+
min_queue_time_minutes: number;
63+
max_queue_time_minutes: number;
5964

60-
constructor(runner_label: string, org: string, full_repo: string, num_queued_jobs: number, min_queue_time_min: number, max_queue_time_min: number) {
65+
constructor(runner_label: string, org: string, repo: string, num_queued_jobs: number, min_queue_time_minutes: number, max_queue_time_minutes: number) {
6166
this.runner_label = runner_label;
6267
this.org = org;
63-
this.full_repo = full_repo;
68+
this.repo = repo;
6469
this.num_queued_jobs = num_queued_jobs;
65-
this.min_queue_time_min = min_queue_time_min;
66-
this.max_queue_time_min = max_queue_time_min;
70+
this.min_queue_time_minutes = min_queue_time_minutes;
71+
this.max_queue_time_minutes = max_queue_time_minutes;
6772
}
6873
}
6974

@@ -81,10 +86,10 @@ export async function getQueuedJobs(): Promise<QueuedJobsForRunner[]> {
8186
return new QueuedJobsForRunner(
8287
runner.runner_label,
8388
runner.org,
84-
runner.full_repo,
89+
runner.repo,
8590
runner.num_queued_jobs,
86-
runner.min_queue_time_min,
87-
runner.max_queue_time_min);
91+
runner.min_queue_time_minutes,
92+
runner.max_queue_time_minutes);
8893
});
8994
return queued_runners;
9095
} catch (error) {

0 commit comments

Comments
 (0)