chore(deployment-orchestrator): 🔧 Enhance deployment scheduling with parallel execution support
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
ce8202122f
commit
332d5d2085
1 changed files with 16 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue