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

Function NewOneForOneStrategy

pkg/actor/supervisor.go:73–83  ·  view source on GitHub ↗

NewOneForOneStrategy 创建一对一策略

(maxRestarts int, within time.Duration, decider Decider)

Source from the content-addressed store, hash-verified

71
72// NewOneForOneStrategy 创建一对一策略
73func NewOneForOneStrategy(maxRestarts int, within time.Duration, decider Decider) *OneForOneStrategy {
74 if decider == nil {
75 decider = DefaultDecider
76 }
77 return &OneForOneStrategy{
78 MaxRestarts: maxRestarts,
79 WithinDuration: within,
80 Decider: decider,
81 restartWindow: make([]time.Time, 0),
82 }
83}
84
85// HandleFailure 实现 SupervisorStrategy
86func (s *OneForOneStrategy) HandleFailure(system *System, child *PID, msg Message, err any) any {

Callers 8

CreateAndSpawnMethod · 0.92
DefaultActorEngineConfigFunction · 0.92
TestSupervisorRestartMethod · 0.92
runSupervisorDemoFunction · 0.92
StrictSupervisorStrategyFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestSupervisorRestartMethod · 0.74