Skip to content

Commit abe443d

Browse files
WenyXucrepererum
authored andcommitted
chore: add comments
Signed-off-by: WenyXu <wenymedia@gmail.com>
1 parent da54e2c commit abe443d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/messenger.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,10 @@ where
418418
cleanup_on_cancel.message_sent();
419419

420420
let mut response = if let Some(timeout) = self.timeout {
421+
// If a request times out, return a `RequestError::IO` with a timeout error.
422+
// This allows the backoff mechanism to detect transport issues and re-establish the connection as needed.
423+
//
424+
// Typically, timeouts occur due to abrupt TCP connection loss (e.g., a disconnected cable).
421425
tokio::time::timeout(timeout, rx).await.map_err(|_| {
422426
RequestError::IO(std::io::Error::new(
423427
std::io::ErrorKind::TimedOut,

0 commit comments

Comments
 (0)