🛠️refactor(circuit-breaker) remove unnecessary condition (#6364)

This commit is contained in:
Binary Alan 2023-12-07 11:40:41 +08:00 committed by GitHub
parent 7f03249ed7
commit 7e2e019ed5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 7 deletions

View File

@ -11,7 +11,7 @@
- [#6342](https://github.com/hyperf/hyperf/pull/6342) Added `Coroutine::fork()` method and `Coroutine::pid()` method.
- [#6360](https://github.com/hyperf/hyperf/pull/6360/files) Added response `content-type` header for swagger server.
- [#6363](https://github.com/hyperf/hyperf/pull/6363) Add callable type support to the fallback property of CircuitBreaker Attribute.
- [#6363](https://github.com/hyperf/hyperf/pull/6363) Added callable type support to the fallback property of CircuitBreaker Attribute.
# v3.1.0 - 2023-12-01

View File

@ -15,9 +15,6 @@ use Attribute;
use Hyperf\CircuitBreaker\Handler\TimeoutHandler;
use Hyperf\Di\Annotation\AbstractAnnotation;
/**
* @property float $timeout
*/
#[Attribute(Attribute::TARGET_METHOD)]
class CircuitBreaker extends AbstractAnnotation
{

View File

@ -30,10 +30,10 @@ class BreakerAnnotationAspect extends AbstractAspect
public function process(ProceedingJoinPoint $proceedingJoinPoint)
{
$metadata = $proceedingJoinPoint->getAnnotationMetadata();
/** @var null|CircuitBreaker $annotation */
$annotation = $metadata->method[CircuitBreaker::class] ?? null;
/** @var CircuitBreaker $annotation */
$annotation = $metadata->method[CircuitBreaker::class];
if (! $annotation) {
if (! $annotation->fallback) {
return $proceedingJoinPoint->process();
}