fix(model): custom model choose error (#164)

This commit is contained in:
Haze
2026-02-25 16:38:03 +08:00
committed by GitHub
Unverified
parent 1166074a52
commit 265b12281c
4 changed files with 98 additions and 64 deletions

View File

@@ -498,8 +498,14 @@ export class GatewayManager extends EventEmitter {
if (pids.length > 0) {
if (!this.process || !pids.includes(String(this.process.pid))) {
logger.info(`Found orphaned process listening on port ${port} (PIDs: ${pids.join(', ')}), attempting to kill...`);
// SIGTERM first so the gateway can clean up its lock file.
for (const pid of pids) {
try { process.kill(parseInt(pid), 'SIGKILL'); } catch { /* ignore */ }
try { process.kill(parseInt(pid), 'SIGTERM'); } catch { /* ignore */ }
}
await new Promise(r => setTimeout(r, 3000));
// SIGKILL any survivors.
for (const pid of pids) {
try { process.kill(parseInt(pid), 0); process.kill(parseInt(pid), 'SIGKILL'); } catch { /* already exited */ }
}
await new Promise(r => setTimeout(r, 1000));
return null;