cep21 / circuit

An efficient and feature complete Hystrix like Go implementation of the circuit breaker pattern.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

while I set General Config Disabled=true, err_concurrency_limit_reject still occur

wangzz719 opened this issue · comments

While I set General Config Disabled=true, err_concurrency_limit_reject still occur.
The code shows:

if c.isEmptyOrNil() || c.threadSafeConfig.CircuitBreaker.Disabled.Get() {
		return runFunc(ctx)
	}

If Disabled is true, it will not stats run and fallback.
Here is my breaker create code:

manager := &CircuitManager{
	Manager: circuit.Manager{
		DefaultCircuitProperties: []circuit.CommandPropertiesConstructor{
			hystrixFactory.Configure,
		},
	},
}
breaker, err := manager.CreateCircuit(name)
if err != nil {
	breaker = manager.GetCircuit(name)
}

breaker.SetConfigThreadSafe(circuit.Config{
	General: circuit.GeneralConfig{
		Disabled: true,
	},
	Execution: circuit.ExecutionConfig{
		MaxConcurrentRequests: 10,
	},
	Fallback: circuit.FallbackConfig{
		MaxConcurrentRequests: 10,
	},
})

So why this happens?

Can you create a unit test that shows the problem, or reproduce it somehow? Maybe the way you're writing your Go code is not passing the breaker pointer correctly?

this is my pull request to fix this problem:
2bf96b0
please take a review.

the breaker in my example Circuit pointer.

Great catch. I took your change in and added a unit test to catch this in the future at #54

Let me know if the problem persist. I've pushed your PR as https://github.com/cep21/circuit/releases/tag/v2.4.1