Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit e72227b

Browse files
authored
fix(scale-down): Clearing cache between runs (#1164)
* fix(scale-down): Clearing cache between runs * Removing debug statement
1 parent ba2536b commit e72227b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Diff for: modules/runners/lambdas/runners/src/scale-runners/cache.ts

+5
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@ export type GhRunners = UnboxPromise<ReturnType<Octokit['actions']['listSelfHost
77
export class githubCache {
88
static clients: Map<string, Octokit> = new Map();
99
static runners: Map<string, GhRunners> = new Map();
10+
11+
public static reset(): void {
12+
githubCache.clients.clear();
13+
githubCache.runners.clear();
14+
}
1015
}

Diff for: modules/runners/lambdas/runners/src/scale-runners/scale-down.ts

+3
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ async function listGitHubRunners(runner: RunnerInfo): Promise<GhRunners> {
5757
runner.type === 'Org'
5858
? await client.paginate(client.actions.listSelfHostedRunnersForOrg, {
5959
org: runner.owner,
60+
per_page: 100,
6061
})
6162
: await client.paginate(client.actions.listSelfHostedRunnersForRepo, {
6263
owner: runner.owner.split('/')[0],
6364
repo: runner.owner.split('/')[1],
65+
per_page: 100,
6466
});
6567
githubCache.runners.set(key, runners);
6668

@@ -182,6 +184,7 @@ function filterRunners(ec2runners: RunnerList[]): RunnerInfo[] {
182184
}
183185

184186
export async function scaleDown(): Promise<void> {
187+
githubCache.reset();
185188
const scaleDownConfigs = JSON.parse(process.env.SCALE_DOWN_CONFIG) as [ScalingDownConfig];
186189
const environment = process.env.ENVIRONMENT;
187190

0 commit comments

Comments
 (0)