MCPcopy Create free account
hub / github.com/astercloud/aster / OneForOneStrategy

Struct OneForOneStrategy

pkg/actor/supervisor.go:59–67  ·  view source on GitHub ↗

============== 内置监督策略 ============== OneForOneStrategy 一对一策略 只重启失败的 Actor,不影响其他子 Actor

Source from the content-addressed store, hash-verified

57// OneForOneStrategy 一对一策略
58// 只重启失败的 Actor,不影响其他子 Actor
59type 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 决策函数类型
70type Decider func(err any) Directive

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected