============== 内置监督策略 ============== OneForOneStrategy 一对一策略 只重启失败的 Actor,不影响其他子 Actor
| 57 | // OneForOneStrategy 一对一策略 |
| 58 | // 只重启失败的 Actor,不影响其他子 Actor |
| 59 | type OneForOneStrategy struct { |
| 60 | MaxRestarts int // 最大重启次数 |
| 61 | WithinDuration time.Duration // 时间窗口 |
| 62 | Decider Decider // 决策函数 |
| 63 | |
| 64 | // 内部状态 |
| 65 | mu sync.Mutex |
| 66 | restartWindow []time.Time |
| 67 | } |
| 68 | |
| 69 | // Decider 决策函数类型 |
| 70 | type Decider func(err any) Directive |
nothing calls this directly
no outgoing calls
no test coverage detected