Skip to content

Commit 9e4cf37

Browse files
committed
Partially revert "Better logging for subscriptions (#2735)" (#2760)
This partially reverts commit a374a43.
1 parent dadb27b commit 9e4cf37

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

linera-rpc/src/grpc/client.rs

+7-12
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,18 @@ impl GrpcClient {
6666

6767
/// Returns whether this gRPC status means the server stream should be reconnected to, or not.
6868
/// Logs a warning on unexpected status codes.
69-
fn is_retryable(status: &Status, address: &str) -> bool {
69+
fn is_retryable(status: &Status) -> bool {
7070
match status.code() {
7171
Code::DeadlineExceeded | Code::Aborted | Code::Unavailable | Code::Unknown => {
72-
info!("gRPC request to {address} interrupted: {status}; retrying");
72+
info!("gRPC request interrupted: {}; retrying", status);
7373
true
7474
}
7575
Code::Ok
7676
| Code::Cancelled
7777
| Code::NotFound
7878
| Code::AlreadyExists
7979
| Code::ResourceExhausted => {
80-
error!("gRPC request to {address} interrupted: {status}; retrying");
80+
error!("Unexpected gRPC status: {}; retrying", status);
8181
true
8282
}
8383
Code::InvalidArgument
@@ -88,7 +88,7 @@ impl GrpcClient {
8888
| Code::Internal
8989
| Code::DataLoss
9090
| Code::Unauthenticated => {
91-
error!("Unexpected gRPC status received from {address}: {status}");
91+
error!("Unexpected gRPC status: {}", status);
9292
false
9393
}
9494
}
@@ -99,7 +99,6 @@ impl GrpcClient {
9999
f: F,
100100
request: impl TryInto<R> + fmt::Debug + Clone,
101101
handler: &str,
102-
address: &str,
103102
) -> Result<S, NodeError>
104103
where
105104
F: Fn(ValidatorNodeClient<transport::Channel>, Request<R>) -> Fut,
@@ -113,17 +112,15 @@ impl GrpcClient {
113112
})?;
114113
loop {
115114
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 => {
117116
let delay = self.retry_delay.saturating_mul(retry_count);
118117
retry_count += 1;
119118
tokio::time::sleep(delay).await;
120119
continue;
121120
}
122121
Err(s) => {
123122
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:?}",),
127124
});
128125
}
129126
Ok(result) => return Ok(result.into_inner()),
@@ -162,7 +159,6 @@ macro_rules! client_delegate {
162159
|mut client, req| async move { client.$handler(req).await },
163160
$req,
164161
stringify!($handler),
165-
&$self.address,
166162
)
167163
.await
168164
}};
@@ -260,7 +256,6 @@ impl ValidatorNode for GrpcClient {
260256

261257
// The stream of `Notification`s that inserts increasing delays after retriable errors, and
262258
// terminates after unexpected or fatal errors.
263-
let address = self.address.clone();
264259
let notification_stream = endlessly_retrying_notification_stream
265260
.map(|result| {
266261
Option::<Notification>::try_from(result?).map_err(|err| {
@@ -273,7 +268,7 @@ impl ValidatorNode for GrpcClient {
273268
retry_count = 0;
274269
return future::Either::Left(future::ready(true));
275270
};
276-
if !Self::is_retryable(status, &address) || retry_count >= max_retries {
271+
if !Self::is_retryable(status) || retry_count >= max_retries {
277272
return future::Either::Left(future::ready(false));
278273
}
279274
let delay = retry_delay.saturating_mul(retry_count);

0 commit comments

Comments
 (0)