diff --git a/src/StateHandlers/OpenStateHandler.php b/src/StateHandlers/OpenStateHandler.php index f99bfe0..920c13d 100644 --- a/src/StateHandlers/OpenStateHandler.php +++ b/src/StateHandlers/OpenStateHandler.php @@ -28,4 +28,24 @@ public function beforeCall(\Closure $action, ...$args) throw CircuitOpenException::make($this->breaker->getName()); } + + /** + * @return void + */ + public function onSucess() + { + $this->breaker->getStorage()->incrementSuccess(); + } + + /** + * @param \Exception $exception + * @return void + * @throws CircuitOpenException + */ + public function onFailure(\Exception $exception) + { + $this->breaker->openCircuit(); + + throw CircuitOpenException::make($this->breaker->getName()); + } }