Skip to content

Commit 06e8e71

Browse files
committed
fix duplicated and misleading error message when the user closes the connection early
1 parent c8531cf commit 06e8e71

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/webserver/http.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ async fn stream_response(stream: impl Stream<Item = DbItem>, mut renderer: AnyRe
6969
}
7070
if let Err(e) = &renderer.flush().await {
7171
log::error!(
72-
"Stopping rendering early because we were unable to flush data to client: {e:#}"
72+
"Stopping rendering early because we were unable to flush data to client. \
73+
The user has probably closed the connection before we finished rendering the page: {e:#}"
7374
);
7475
// If we cannot write to the client anymore, there is nothing we can do, so we just stop rendering
7576
return;

src/webserver/response_writer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl tokio::io::AsyncWrite for AsyncResponseWriter {
143143
impl Drop for ResponseWriter {
144144
fn drop(&mut self) {
145145
if let Err(e) = std::io::Write::flush(self) {
146-
log::error!("Could not flush data to client: {e}");
146+
log::debug!("Could not flush data to client: {e}");
147147
}
148148
}
149149
}

0 commit comments

Comments
 (0)