File tree 1 file changed +21
-14
lines changed 1 file changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -473,39 +473,46 @@ where
473
473
Err ( e) => e,
474
474
} ;
475
475
476
- match error {
476
+ let retry = match error {
477
477
Error :: Request ( RequestError :: Poisoned ( _) | RequestError :: IO ( _) )
478
- | Error :: Connection ( _) => broker_cache. invalidate ( ) . await ,
478
+ | Error :: Connection ( _) => {
479
+ broker_cache. invalidate ( ) . await ;
480
+ true
481
+ }
479
482
Error :: ServerError {
480
483
protocol_error :
481
484
ProtocolError :: InvalidReplicationFactor
482
485
| ProtocolError :: LeaderNotAvailable
483
486
| ProtocolError :: OffsetNotAvailable ,
484
487
..
485
- } => { }
488
+ } => true ,
486
489
Error :: ServerError {
487
490
protocol_error : ProtocolError :: NotLeaderOrFollower ,
488
491
..
489
492
} => {
490
493
broker_cache. invalidate ( ) . await ;
494
+ true
491
495
}
492
496
Error :: ServerError {
493
497
protocol_error : ProtocolError :: UnknownTopicOrPartition ,
494
498
..
495
- } if unknown_topic_handling == UnknownTopicHandling :: Retry => {
499
+ } => {
496
500
broker_cache. invalidate ( ) . await ;
501
+ unknown_topic_handling == UnknownTopicHandling :: Retry
497
502
}
498
- _ => {
499
- error ! (
500
- e=%error,
501
- request_name,
502
- "request encountered fatal error" ,
503
- ) ;
504
- return ControlFlow :: Break ( Err ( error) ) ;
505
- }
506
- }
503
+ _ => false ,
504
+ } ;
507
505
508
- ControlFlow :: Continue ( error)
506
+ if retry {
507
+ ControlFlow :: Continue ( error)
508
+ } else {
509
+ error ! (
510
+ e=%error,
511
+ request_name,
512
+ "request encountered fatal error" ,
513
+ ) ;
514
+ ControlFlow :: Break ( Err ( error) )
515
+ }
509
516
} )
510
517
. await
511
518
. map_err ( Error :: RetryFailed ) ?
You can’t perform that action at this time.
0 commit comments