Timeout provider as resource

This commit is contained in:
Dominik Werder
2024-11-07 15:13:45 +01:00
parent aa126888ab
commit e89904244c
9 changed files with 195 additions and 85 deletions

View File

@@ -266,15 +266,14 @@ async fn binned_json_framed(
let open_bytes = Arc::pin(OpenBoxedBytesViaHttp::new(ncc.node_config.cluster.clone()));
let (events_read_provider, cache_read_provider) =
make_read_provider(ch_conf.name(), scyqueue, open_bytes, ctx, ncc);
let stream_timeout = streamio::streamtimeout::StreamTimeout::new();
let stream_timeout = Box::new(stream_timeout);
let timeout_provider = streamio::streamtimeout::StreamTimeout::boxed();
let stream = streams::timebinnedjson::timebinned_json_framed(
query,
ch_conf,
ctx,
cache_read_provider,
events_read_provider,
stream_timeout,
timeout_provider,
)
.instrument(span1)
.await?;

View File

@@ -177,7 +177,9 @@ async fn plain_events_cbor_framed(
debug!("plain_events_cbor_framed {ch_conf:?} {req:?}");
let open_bytes = OpenBoxedBytesViaHttp::new(ncc.node_config.cluster.clone());
let open_bytes = Arc::pin(open_bytes);
let stream = streams::plaineventscbor::plain_events_cbor_stream(&evq, ch_conf, ctx, open_bytes).await?;
let timeout_provider = streamio::streamtimeout::StreamTimeout::boxed();
let stream =
streams::plaineventscbor::plain_events_cbor_stream(&evq, ch_conf, ctx, open_bytes, timeout_provider).await?;
let stream = bytes_chunks_to_framed(stream);
let logspan = if evq.log_level() == "trace" {
trace!("enable trace for handler");