Suppress maintenance watchers during provisioning
Keep maintenance observations and automatic requests clear of active lifecycle operations and retained recovery capacity while preserving owned recovery and explicit retries. Fixes #55
This commit is contained in:
@@ -1,5 +1,14 @@
|
||||
import { db } from '../db/index.js';
|
||||
|
||||
/** Maintenance must leave pending lifecycle work and retained recovery to Provisioning. */
|
||||
export function hasActiveProvisioning(server: string, exceptOperationId = ''): boolean {
|
||||
return !!db().prepare(`SELECT 1 FROM server_deployments
|
||||
WHERE server = ? AND server_deleted_at IS NULL AND id != ?
|
||||
AND state IN ('queued', 'waiting', 'running', 'awaiting-health') LIMIT 1`).get(server, exceptOperationId)
|
||||
|| !!db().prepare(`SELECT 1 FROM restart_rollout WHERE server = ? AND healthy_at IS NULL
|
||||
AND (operation_id IS NULL OR operation_id != ?)`).get(server, exceptOperationId);
|
||||
}
|
||||
|
||||
/** Only the latest lifecycle operation can describe the current server. */
|
||||
export function isProvisioning(server: string): boolean {
|
||||
const operation = db().prepare(`SELECT action, state FROM server_deployments
|
||||
|
||||
Reference in New Issue
Block a user