ackintosh / ganesha

:elephant: A Circuit Breaker pattern implementation for PHP applications.
https://ackintosh.github.io/ganesha/
MIT License
585 stars 42 forks source link

intervalToHalfOpen not work for Redis storage #29

Closed wenbinye closed 5 years ago

wenbinye commented 5 years ago

Redis storage adapter does not implements saveLastFailureTime,and loadLastFailureTime suppose the key is failureKey, instead of lastFailureKey, so always got null value.

Change Ackintosh\Ganesha\Storage lastFailureKey as following works:


    /**
     * @param  string $service
     * @return string
     */
    private function lastFailureKey($service)
    {
        return $this->supportRollingTimeWindow() 
            ? $this->failureKey($service) 
            : $this->prefix($service) . self::KEY_SUFFIX_LAST_FAILURE_TIME;
    }
ackintosh commented 5 years ago

@wenbinye Thanks for reporting the issue! I'll have a look this weekend. 😉

ackintosh commented 5 years ago

@wenbinye I've fixed the issue on #30. which is released as v0.2.2. Thank you again. 👍