Queue native collection launches before async placement
This commit is contained in:
@@ -15,7 +15,19 @@ export function nativeInstance(server: string): NativeInstance | null {
|
||||
}
|
||||
|
||||
export function nativeDeployment(id: string): boolean {
|
||||
return !!db().prepare('SELECT 1 FROM native_provisioning WHERE deployment_id = ?').get(id);
|
||||
return !!db().prepare(`SELECT 1 FROM native_provisioning WHERE deployment_id = ?
|
||||
UNION ALL SELECT 1 FROM native_creation_intents WHERE deployment_id = ?
|
||||
UNION ALL SELECT 1 FROM native_creation_cancellations c
|
||||
JOIN native_creation_intents i ON i.deployment_id=c.creation_id WHERE c.cleanup_id = ? LIMIT 1`).get(id, id, id);
|
||||
}
|
||||
|
||||
export function unplacedNativeCreation(server: string): string | null {
|
||||
const row = db().prepare(`SELECT d.id FROM server_deployments d
|
||||
JOIN native_creation_intents i ON i.deployment_id=d.id
|
||||
LEFT JOIN native_provisioning n ON n.deployment_id=d.id
|
||||
WHERE d.server=? AND d.server_deleted_at IS NULL AND d.action='create' AND d.state='queued'
|
||||
AND n.deployment_id IS NULL ORDER BY d.rowid DESC LIMIT 1`).get(server) as { id: string } | undefined;
|
||||
return row?.id ?? null;
|
||||
}
|
||||
|
||||
const observations = new Map<string, Promise<unknown>>();
|
||||
|
||||
Reference in New Issue
Block a user