@@ -66,18 +66,18 @@ impl GrpcClient {
66
66
67
67
/// Returns whether this gRPC status means the server stream should be reconnected to, or not.
68
68
/// Logs a warning on unexpected status codes.
69
- fn is_retryable ( status : & Status , address : & str ) -> bool {
69
+ fn is_retryable ( status : & Status ) -> bool {
70
70
match status. code ( ) {
71
71
Code :: DeadlineExceeded | Code :: Aborted | Code :: Unavailable | Code :: Unknown => {
72
- info ! ( "gRPC request to {address} interrupted: {status }; retrying" ) ;
72
+ info ! ( "gRPC request interrupted: {}; retrying" , status ) ;
73
73
true
74
74
}
75
75
Code :: Ok
76
76
| Code :: Cancelled
77
77
| Code :: NotFound
78
78
| Code :: AlreadyExists
79
79
| Code :: ResourceExhausted => {
80
- error ! ( "gRPC request to {address} interrupted : {status }; retrying" ) ;
80
+ error ! ( "Unexpected gRPC status : {}; retrying" , status ) ;
81
81
true
82
82
}
83
83
Code :: InvalidArgument
@@ -88,7 +88,7 @@ impl GrpcClient {
88
88
| Code :: Internal
89
89
| Code :: DataLoss
90
90
| Code :: Unauthenticated => {
91
- error ! ( "Unexpected gRPC status received from {address} : {status}" ) ;
91
+ error ! ( "Unexpected gRPC status: {}" , status ) ;
92
92
false
93
93
}
94
94
}
@@ -99,7 +99,6 @@ impl GrpcClient {
99
99
f : F ,
100
100
request : impl TryInto < R > + fmt:: Debug + Clone ,
101
101
handler : & str ,
102
- address : & str ,
103
102
) -> Result < S , NodeError >
104
103
where
105
104
F : Fn ( ValidatorNodeClient < transport:: Channel > , Request < R > ) -> Fut ,
@@ -113,17 +112,15 @@ impl GrpcClient {
113
112
} ) ?;
114
113
loop {
115
114
match f ( self . client . clone ( ) , Request :: new ( request_inner. clone ( ) ) ) . await {
116
- Err ( s) if Self :: is_retryable ( & s, address ) && retry_count < self . max_retries => {
115
+ Err ( s) if Self :: is_retryable ( & s) && retry_count < self . max_retries => {
117
116
let delay = self . retry_delay . saturating_mul ( retry_count) ;
118
117
retry_count += 1 ;
119
118
tokio:: time:: sleep ( delay) . await ;
120
119
continue ;
121
120
}
122
121
Err ( s) => {
123
122
return Err ( NodeError :: GrpcError {
124
- error : format ! (
125
- "remote request [{handler}] to {address} failed with status: {s:?}" ,
126
- ) ,
123
+ error : format ! ( "remote request [{handler}] failed with status: {s:?}" , ) ,
127
124
} ) ;
128
125
}
129
126
Ok ( result) => return Ok ( result. into_inner ( ) ) ,
@@ -162,7 +159,6 @@ macro_rules! client_delegate {
162
159
|mut client, req| async move { client. $handler( req) . await } ,
163
160
$req,
164
161
stringify!( $handler) ,
165
- & $self. address,
166
162
)
167
163
. await
168
164
} } ;
@@ -260,7 +256,6 @@ impl ValidatorNode for GrpcClient {
260
256
261
257
// The stream of `Notification`s that inserts increasing delays after retriable errors, and
262
258
// terminates after unexpected or fatal errors.
263
- let address = self . address . clone ( ) ;
264
259
let notification_stream = endlessly_retrying_notification_stream
265
260
. map ( |result| {
266
261
Option :: < Notification > :: try_from ( result?) . map_err ( |err| {
@@ -273,7 +268,7 @@ impl ValidatorNode for GrpcClient {
273
268
retry_count = 0 ;
274
269
return future:: Either :: Left ( future:: ready ( true ) ) ;
275
270
} ;
276
- if !Self :: is_retryable ( status, & address ) || retry_count >= max_retries {
271
+ if !Self :: is_retryable ( status) || retry_count >= max_retries {
277
272
return future:: Either :: Left ( future:: ready ( false ) ) ;
278
273
}
279
274
let delay = retry_delay. saturating_mul ( retry_count) ;
0 commit comments