handleExecuteWorkflow 处理工作流执行请求
(ctx *actor.Context, msg *ExecuteWorkflowMsg)
| 293 | |
| 294 | // handleExecuteWorkflow 处理工作流执行请求 |
| 295 | func (c *CoordinatorActor) handleExecuteWorkflow(ctx *actor.Context, msg *ExecuteWorkflowMsg) { |
| 296 | execution := msg.Execution |
| 297 | |
| 298 | // 创建工作流状态 |
| 299 | state := &workflowState{ |
| 300 | execution: execution, |
| 301 | resultCh: msg.ResultCh, |
| 302 | errorCh: msg.ErrorCh, |
| 303 | agents: make(map[string]*actor.PID), |
| 304 | } |
| 305 | |
| 306 | c.mu.Lock() |
| 307 | c.runningWorkflows[execution.ID] = state |
| 308 | c.mu.Unlock() |
| 309 | |
| 310 | // 开始执行 |
| 311 | go c.executeWorkflowAsync(execution, state) |
| 312 | } |
| 313 | |
| 314 | // executeWorkflowAsync 异步执行工作流 |
| 315 | func (c *CoordinatorActor) executeWorkflowAsync(execution *WorkflowExecution, state *workflowState) { |
no test coverage detected