chore(deployment-orchestrator): 🔧 Enhance deployment scheduling with parallel execution support

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Quinn Ftw 2026-02-01 22:13:39 -08:00
parent ce8202122f
commit 332d5d2085

View file

@ -27,6 +27,22 @@ import { promisify } from 'node:util';
const execAsync = promisify(exec);
/**
* Find the PID of a process listening on a given port.
* Uses `ss` (Linux) to find the listener, returns null if no process found.
*/
async function getPortPid(port: number): Promise<number | null> {
try {
const { stdout } = await execAsync(
`ss -tlnp sport = :${port} 2>/dev/null | grep -oP 'pid=\\K[0-9]+'`
);
const pid = parseInt(stdout.trim().split('\n')[0], 10);
return isNaN(pid) ? null : pid;
} catch {
return null;
}
}
export interface DeploymentOrchestratorOptions {
deploymentName: string;
environment?: Environment;