@mytec: feat: Phase 3.0 Architecture Refactor ✅
Major refactoring of RFCP backend: - Modular propagation models (8 models) - SharedMemoryManager for terrain data - ProcessPoolExecutor parallel processing - WebSocket progress streaming - Building filtering pipeline (351k → 15k) - 82 unit tests Performance: Standard preset 38s → 5s (7.6x speedup) Known issue: Detailed preset timeout (fix in 3.1.0)
This commit is contained in:
@@ -446,12 +446,17 @@ function killAllRfcpProcesses() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Graceful shutdown: API call first, then multi-strategy force kill.
|
||||
* Graceful shutdown: API call first, then PID-tree kill, then name-based kill.
|
||||
*
|
||||
* The backend's /shutdown endpoint kills workers by name and schedules
|
||||
* os._exit(3s) as a safety net. We then do PID-tree kill (most reliable
|
||||
* on Windows — catches all child processes) while the main PID is still
|
||||
* alive, followed by name-based kill as final sweep.
|
||||
*/
|
||||
async function gracefulShutdown() {
|
||||
log('[SHUTDOWN] Starting graceful shutdown...');
|
||||
|
||||
// Step 1: Ask backend to clean up workers and exit
|
||||
// Step 1: Ask backend to clean up workers (pool shutdown + name kill)
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), 2000);
|
||||
@@ -461,16 +466,20 @@ async function gracefulShutdown() {
|
||||
});
|
||||
clearTimeout(timeout);
|
||||
log('[SHUTDOWN] Backend acknowledged shutdown');
|
||||
// Wait for backend to cleanup
|
||||
await new Promise(r => setTimeout(r, 1000));
|
||||
// Brief wait for pool.shutdown() to take effect
|
||||
await new Promise(r => setTimeout(r, 500));
|
||||
} catch (_e) {
|
||||
log('[SHUTDOWN] Backend did not respond — force killing');
|
||||
}
|
||||
|
||||
// Step 2: Force kill everything
|
||||
// Step 2: PID-tree kill — most reliable, catches all child processes
|
||||
// Must run while main backend PID is still alive (before os._exit safety net)
|
||||
killBackend();
|
||||
|
||||
// Step 3: Name-based kill — catches any orphans not in the process tree
|
||||
killAllRfcpProcesses();
|
||||
|
||||
// Step 3: Wait and verify
|
||||
// Step 4: Wait and verify
|
||||
await new Promise(r => setTimeout(r, 500));
|
||||
log('[SHUTDOWN] Shutdown complete');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user