Remove autoscaling action cooldown
This commit is contained in:
@@ -5,7 +5,7 @@ export function ensureAutoscalingSchema(handle: Database.Database): void {
|
||||
CREATE TABLE IF NOT EXISTS autoscaling_policies (
|
||||
id TEXT PRIMARY KEY, game TEXT NOT NULL, map_slug TEXT NOT NULL,
|
||||
revision INTEGER NOT NULL DEFAULT 1, settings TEXT NOT NULL,
|
||||
mode TEXT NOT NULL DEFAULT 'off', next_action_at INTEGER NOT NULL DEFAULT 0,
|
||||
mode TEXT NOT NULL DEFAULT 'off',
|
||||
paused_reason TEXT, owns_map INTEGER NOT NULL DEFAULT 0, updated_at TEXT NOT NULL,
|
||||
UNIQUE(game,map_slug)
|
||||
);
|
||||
@@ -34,9 +34,15 @@ export function ensureAutoscalingSchema(handle: Database.Database): void {
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS autoscaling_sample_retention ON autoscaling_samples(sampled_at);
|
||||
`);
|
||||
// Removed modes must not silently gain permission to destroy lobbies.
|
||||
// Keep ownership while delivered work settles through normal reconciliation.
|
||||
handle.transaction(() => {
|
||||
const columns = handle.pragma('table_info(autoscaling_policies)') as { name: string }[];
|
||||
if (columns.some(column => column.name === 'next_action_at')) {
|
||||
handle.exec('ALTER TABLE autoscaling_policies DROP COLUMN next_action_at');
|
||||
}
|
||||
handle.exec(`UPDATE autoscaling_policies SET settings=json_remove(settings,'$.cooldownMinutes')
|
||||
WHERE json_type(settings,'$.cooldownMinutes') IS NOT NULL`);
|
||||
// Removed modes must not silently gain permission to destroy lobbies.
|
||||
// Keep ownership while delivered work settles through normal reconciliation.
|
||||
handle.prepare(`UPDATE autoscaling_authorizations SET revoked_at=?
|
||||
WHERE claimed_at IS NULL AND revoked_at IS NULL AND policy_id IN
|
||||
(SELECT id FROM autoscaling_policies WHERE mode IN ('dry-run','create-only'))`).run(Date.now());
|
||||
|
||||
Reference in New Issue
Block a user