mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 18:27:44 +08:00
🛠️refactor(circuit-breaker) remove unnecessary condition (#6364)
This commit is contained in:
parent
7f03249ed7
commit
7e2e019ed5
@ -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
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user