Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

Checkpoint: File edits

rUve42a1df44ec6
diff --git a/v3/@claude-flow/cli/src/services/container-worker-pool.ts b/v3/@claude-flow/cli/src/services/container-worker-pool.ts
index 751ceebb68..ac4fe134c5 100644
--- a/v3/@claude-flow/cli/src/services/container-worker-pool.ts
+++ b/v3/@claude-flow/cli/src/services/container-worker-pool.ts
@@ -313,12 +313,17 @@ export class ContainerWorkerPool extends EventEmitter {
* Shutdown the pool
*/
async shutdown(): Promise<void> {
+ if (this.isShuttingDown) return;
+ this.isShuttingDown = true;
+
// Stop timers
if (this.healthCheckTimer) {
clearInterval(this.healthCheckTimer);
+ this.healthCheckTimer = undefined;
}
if (this.idleCheckTimer) {
clearInterval(this.idleCheckTimer);
+ this.idleCheckTimer = undefined;
}
// Reject queued tasks
@@ -327,12 +332,21 @@ export class ContainerWorkerPool extends EventEmitter {
}
this.taskQueue = [];
- // Terminate all containers
+ // Terminate all containers with timeout
const terminatePromises: Promise<void>[] = [];
for (const [id] of this.containers) {
- terminatePromises.push(this.terminateContainer(id));
+ terminatePromises.push(
+ this.terminateContainer(id).catch(() => {
+ // Ignore errors during shutdown
+ })
+ );
}
- await Promise.all(terminatePromises);
+
+ // Wait for all containers with 30s timeout
+ await Promise.race([
+ Promise.all(terminatePromises),
+ new Promise<void>(resolve => setTimeout(resolve, 30000)),
+ ]);
this.initialized = false;
this.emit('shutdown', {});