You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
funcmain() {
// f := rolling.StatFactory{}h:= circuit.Manager{
DefaultCircuitProperties: []circuit.CommandPropertiesConstructor{
// f.CreateConfig,func(circuitNamestring) circuit.Config {
return circuit.Config{
Execution: circuit.ExecutionConfig{
MaxConcurrentRequests: 1000,
},
General: circuit.GeneralConfig{
OpenToClosedFactory: hystrix.CloserFactory(hystrix.ConfigureCloser{
// // This should allow a new request every 10 millisecondsSleepWindow: time.Millisecond*10,
}),
ClosedToOpenFactory: hystrix.OpenerFactory(hystrix.ConfigureOpener{
RequestVolumeThreshold: 10,
ErrorThresholdPercentage: 50,
}),
},
}
},
},
}
c:=h.MustCreateCircuit("hello-world")
fmt.Printf("var = %+v\n", h.Var())
loop:=100fori:=0; i<loop; i++ {
time.Sleep(500*time.Millisecond)
errResult:=c.Execute(context.Background(), func(ctx context.Context) error {
ifi>10 {
returnnil
}
returnfmt.Errorf("err i %d", i)
}, nil)
fmt.Println("Result of execution:", errResult)
}
}
AKAIK, circuit should open after 10*50%=5 failed response within rolling window(default: 10s), but it execute successfully
revision: 7687802
Output
Result of execution: err i 0
Result of execution: err i 1
Result of execution: err i 2
Result of execution: err i 3
Result of execution: err i 4
Result of execution: err i 5
Result of execution: err i 6
Result of execution: err i 7
Result of execution: err i 8
Result of execution: err i 9
Result of execution: err i 10
Result of execution: <nil>
Result of execution: <nil>
Result of execution: <nil>
Result of execution: <nil>
Result of execution: <nil>
The text was updated successfully, but these errors were encountered:
AKAIK, circuit should open after
10*50%=5
failed response within rolling window(default: 10s), but it execute successfullyrevision: 7687802
Output
The text was updated successfully, but these errors were encountered: