Add autoscaling dry run and policy controls

This commit is contained in:
2026-10-06 22:52:50 -04:00
parent ed4d8a4802
commit 36cf2b9c05
11 changed files with 317 additions and 4 deletions
+4 -2
View File
@@ -1,4 +1,5 @@
import { pruneHistory, pruneSampleHistory } from '../retention.js';
import { runAutoscaling, pruneAutoscaling } from '../autoscaling/index.js';
import { config } from '../config.js';
import { processProvisioning } from '../provisioning/worker.js';
import { sweep } from './sweep.js';
@@ -54,8 +55,9 @@ function reconcileRequesters(): void {
['campaign', 'Reconciling campaigns', sweep],
['beta', 'Reconciling beta tests', betaTick],
['maintenance', 'Checking maintenance and recovery', runMaintenance],
['autoscaling', 'Evaluating lobby autoscaling', runAutoscaling],
['game-files', 'Removing unused game files', cleanupControllerLibraries],
['retention', 'Cleaning expired history', async () => { pruneHistory(); pruneSampleHistory(); }]
['retention', 'Cleaning expired history', async () => { pruneHistory(); pruneSampleHistory(); pruneAutoscaling(); }]
];
for (const [key, label, work] of requesters) {
if (requesterFlights.has(key)) continue;
@@ -65,7 +67,7 @@ function reconcileRequesters(): void {
}
const flight = trackActivity(key, label, work)
.catch(err => { console.error(`[worker] ${key} error:`, err); })
.then(async () => { if (key !== 'game-files' && key !== 'retention') await tick(true); })
.then(async result => { if (key !== 'game-files' && key !== 'retention' && (key !== 'autoscaling' || result === true)) await tick(true); })
.finally(() => { requesterFlights.delete(key); });
requesterFlights.set(key, flight);
}