diff --git a/modules/runners/lambdas/runners/src/scale-runners/cache.ts b/modules/runners/lambdas/runners/src/scale-runners/cache.ts index 8c0c34a14a..302a24b2d5 100644 --- a/modules/runners/lambdas/runners/src/scale-runners/cache.ts +++ b/modules/runners/lambdas/runners/src/scale-runners/cache.ts @@ -7,4 +7,9 @@ export type GhRunners = UnboxPromise = new Map(); static runners: Map = new Map(); + + public static reset(): void { + githubCache.clients.clear(); + githubCache.runners.clear(); + } } diff --git a/modules/runners/lambdas/runners/src/scale-runners/scale-down.ts b/modules/runners/lambdas/runners/src/scale-runners/scale-down.ts index f05c8317e0..f96df1893b 100644 --- a/modules/runners/lambdas/runners/src/scale-runners/scale-down.ts +++ b/modules/runners/lambdas/runners/src/scale-runners/scale-down.ts @@ -57,10 +57,12 @@ async function listGitHubRunners(runner: RunnerInfo): Promise { runner.type === 'Org' ? await client.paginate(client.actions.listSelfHostedRunnersForOrg, { org: runner.owner, + per_page: 100, }) : await client.paginate(client.actions.listSelfHostedRunnersForRepo, { owner: runner.owner.split('/')[0], repo: runner.owner.split('/')[1], + per_page: 100, }); githubCache.runners.set(key, runners); @@ -182,6 +184,7 @@ function filterRunners(ec2runners: RunnerList[]): RunnerInfo[] { } export async function scaleDown(): Promise { + githubCache.reset(); const scaleDownConfigs = JSON.parse(process.env.SCALE_DOWN_CONFIG) as [ScalingDownConfig]; const environment = process.env.ENVIRONMENT;