From 1a8cdd6b0f9d42a870759c9fb764ec7b4ccd0904 Mon Sep 17 00:00:00 2001 From: Stefan Damjanovic Date: Sat, 27 Jan 2024 11:03:30 +0100 Subject: [PATCH] Move storage init to set storage method --- src/CircuitBreaker.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CircuitBreaker.php b/src/CircuitBreaker.php index 9df32b5..d03c640 100755 --- a/src/CircuitBreaker.php +++ b/src/CircuitBreaker.php @@ -56,8 +56,6 @@ private function __construct(string $name) */ public function call(\Closure $action, ...$args) { - $this->storage->init($this); - $stateHandler = $this->makeStateHandler(); return $stateHandler->call($action, $args); @@ -209,6 +207,8 @@ public function skipFailureCount(\Closure $closure) public function storage(CircuitBreakerStorage $storage) { $this->storage = $storage; + + $this->storage->init($this); return $this; }