OnAgentStop 通知所有中间件 Agent 停止
(ctx context.Context, agentID string)
| 88 | |
| 89 | // OnAgentStop 通知所有中间件 Agent 停止 |
| 90 | func (s *Stack) OnAgentStop(ctx context.Context, agentID string) error { |
| 91 | // 逆序通知(LIFO) |
| 92 | for i := len(s.middlewares) - 1; i >= 0; i-- { |
| 93 | if err := s.middlewares[i].OnAgentStop(ctx, agentID); err != nil { |
| 94 | return err |
| 95 | } |
| 96 | } |
| 97 | return nil |
| 98 | } |
| 99 | |
| 100 | // Middlewares 返回中间件列表 |
| 101 | func (s *Stack) Middlewares() []Middleware { |