{"record":{"id":"24046904e48081f7","repo":"ruvnet/ruflo","slug":"worker-spawn-exceeded-50ms-target-spawntime-tof","errorCode":null,"errorMessage":"Worker spawn exceeded 50ms target: ${spawnTime.toFixed(2)}ms","messagePattern":"Worker spawn exceeded 50ms target: (.+?)ms","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/swarm/src/workers/worker-dispatch.ts","lineNumber":408,"sourceCode":"    this.workers.set(workerId, worker);\n\n    // Add to queue with priority\n    const priority = this.getPriorityValue(options.priority || TRIGGER_CONFIGS[trigger].priority);\n    this.queue.push({ id: workerId, priority });\n\n    if (this.config.priorityQueue) {\n      this.queue.sort((a, b) => b.priority - a.priority);\n    }\n\n    // Emit event\n    this.emit('worker:queued', { workerId, trigger, context });\n\n    // Process queue\n    await this.processQueue();\n\n    const spawnTime = performance.now() - startTime;\n    if (spawnTime > 50) {\n      console.warn(`Worker spawn exceeded 50ms target: ${spawnTime.toFixed(2)}ms`);\n    }\n\n    return workerId;\n  }\n\n  /**\n   * Detect triggers in a prompt/context\n   *\n   * @param text - Text to analyze\n   * @returns Detection result\n   */\n  detectTriggers(text: string): TriggerDetectionResult {\n    const startTime = performance.now();\n    const detectedTriggers: WorkerTrigger[] = [];\n    let totalMatches = 0;\n\n    for (const [trigger, patterns] of Object.entries(TRIGGER_PATTERNS) as [WorkerTrigger, RegExp[]][]) {\n      for (const pattern of patterns) {","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/swarm/src/workers/worker-dispatch.ts#L390-L426","documentation":"Performance warning in WorkerDispatch.dispatch(): spawning and queueing a worker took longer than the 50ms latency target measured via performance.now(). Functionally successful; flags regression in spawn-path performance.","triggerScenarios":"Worker thread spawn latency exceeds the 50ms performance budget; occurs under CPU contention, cold V8 isolate startup, large bundled worker entry scripts, or when the host process is near its thread/file-descriptor limits.","commonSituations":"See trigger scenarios.","solutions":["Reduce per-spawn initialization work (lazy-load modules, reuse worker pools) to bring spawn time under the 50ms target.","Pre-warm worker threads/processes at startup so dispatch does not pay cold-start cost.","Profile the spawn path to find the slow step (module load, IPC setup, serialization) and optimize it."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}