upwork / phystrix

Phystrix is a latency and fault tolerance library for PHP, inspired by Netflix’s Hystrix
Apache License 2.0
1 stars 0 forks source link

BadRequestException should close the CircuitBreaker? #39

Open he-li opened 4 years ago

he-li commented 4 years ago

Hi, We're using phystrix circuit breaker. and it's very successful.

I have a question regarding to the BadRequestException, which from what I understand is a client error. So circuit breaker should not be opened; or if it's already opened should be closed. What do you think in case of allowSingleTest, should there be a $circuitBreaker->markSuccess(); here Thanks

lcf commented 4 years ago

Hi @he-li ,

That is an interesting question! And the answer is yes!

I tried to check how they handle this situation in Hystrix - the Java library this was inspired by and based on, but they had gone quite far from the time Phystrix was written and I don't even see that method "allowSingleTest" used anymore...

But if it was used, from the way the exceptions are handled, I understand BadRequestException would be handled as a "Success". So you are absolutely right.

If you care to submit a PR - I will be glad to accept it