fix: reap completed response send tasks (#1026)

This commit is contained in:
N0zoM1z0 2026-07-23 10:01:45 +09:00 • committed by GitHub
commit 50dd8e2040
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1230,6 +1230,7 @@ where
PeerMessage(RxJsonRpcMessage<R>), PeerMessage(RxJsonRpcMessage<R>),
ToSink(TxJsonRpcMessage<R>), ToSink(TxJsonRpcMessage<R>),
SendTaskResult(SendTaskResult), SendTaskResult(SendTaskResult),
ResponseSendTaskResult(Result<(), tokio::task::JoinError>),
} }
let quit_reason = loop { let quit_reason = loop {
@ -1275,6 +1276,11 @@ where
} }
} }
} }
result = response_send_tasks.join_next(), if !response_send_tasks.is_empty() => {
Event::ResponseSendTaskResult(
result.expect("non-empty response send task set")
)
}
_ = serve_loop_ct.cancelled() => { _ = serve_loop_ct.cancelled() => {
tracing::info!("task cancelled"); tracing::info!("task cancelled");
break QuitReason::Cancelled break QuitReason::Cancelled
@ -1313,6 +1319,11 @@ where
} }
} }
} }
Event::ResponseSendTaskResult(result) => {
if let Err(error) = result {
tracing::error!(%error, "response send task failed");
}
}
// response and error // response and error
Event::ToSink(m) => { Event::ToSink(m) => {
if let Some(id) = match &m { if let Some(id) = match &m {