diff --git a/src/utils/html.rs b/src/utils/html.rs
index bae9d19c2..2b55b977a 100644
--- a/src/utils/html.rs
+++ b/src/utils/html.rs
@@ -1,5 +1,6 @@
use crate::{
InstanceMetrics,
+ utils::report_error,
web::{
page::{
TemplateData,
@@ -8,6 +9,7 @@ use crate::{
rustdoc::RustdocPage,
},
};
+use anyhow::{Context as _, anyhow};
use askama::Template;
use async_stream::stream;
use axum::body::Bytes;
@@ -18,6 +20,8 @@ use tokio::{io::AsyncRead, task::JoinHandle};
use tokio_util::io::ReaderStream;
use tracing::error;
+const CHANNEL_SIZE: usize = 64;
+
#[derive(thiserror::Error, Debug)]
pub(crate) enum RustdocRewritingError {
#[error("HTML rewriter error: {0}")]
@@ -38,13 +42,15 @@ pub(crate) fn rewrite_rustdoc_html_stream(
max_allowed_memory_usage: usize,
data: Arc,
metrics: Arc,
-) -> impl Stream- >
+) -> impl Stream
- > + Send + 'static
where
- R: AsyncRead + Unpin + 'static,
+ R: AsyncRead + Unpin + Send + 'static,
{
stream!({
- let (input_sender, input_receiver) = std::sync::mpsc::channel::