Skip to content

Commit c335fc7

Browse files
committed
fix: refactor orphan termination logic for clarity and consistency
1 parent 6dca64f commit c335fc7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lambdas/functions/control-plane/src/scale-runners/scale-down.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,12 @@ async function terminateOrphan(environment: string): Promise<void> {
244244

245245
for (const runner of orphanRunners) {
246246
if (runner.runnerId) {
247-
(await lastChanceCheckOrphanRunner(runner))
248-
? terminateRunner(runner.instanceId)
249-
: unmarkOrphan(runner.instanceId);
247+
const isOrphan = await lastChanceCheckOrphanRunner(runner);
248+
if (isOrphan) {
249+
await terminateRunner(runner.instanceId);
250+
} else {
251+
await unmarkOrphan(runner.instanceId);
252+
}
250253
} else {
251254
logger.info(`Terminating orphan runner '${runner.instanceId}'`);
252255
await terminateRunner(runner.instanceId).catch((e) => {

0 commit comments

Comments
 (0)