This commit is contained in:
Mateusz Gruszczyński committed 2026-10-05 09:30:21 +02:00
1 parent 1dea7f55c8
commit c819f0a335
151 files changed
+7610 -4264

No files matched your search

+19 -10
View File
@@ -188,14 +188,12 @@ async fn logs(
})
.take(limit)
.collect();
Ok(Json(
json!({
"entries": entries,
"capacity": crate::logging::HISTORY_CAPACITY,
"window": crate::logging::LIVE_WINDOW,
"dropped": state.logs.dropped.load(Ordering::Relaxed)
}),
))
Ok(Json(json!({
"entries": entries,
"capacity": crate::logging::HISTORY_CAPACITY,
"window": crate::logging::LIVE_WINDOW,
"dropped": state.logs.dropped.load(Ordering::Relaxed)
})))
}
async fn live_logs_stream(
@@ -208,7 +206,12 @@ async fn live_logs_stream(
.viewer_slots
.clone()
.try_acquire_owned()
.map_err(|_| ApiError(StatusCode::TOO_MANY_REQUESTS, "events.too_many_viewers".into()))?;
.map_err(|_| {
ApiError(
StatusCode::TOO_MANY_REQUESTS,
"events.too_many_viewers".into(),
)
})?;
let receiver = state.logs.subscribe();
let next_auth_check = tokio::time::Instant::now() + Duration::from_secs(10);
let stream = futures_util::stream::unfold(
@@ -344,7 +347,13 @@ async fn traffic_status(
) -> Result<Json<Value>, ApiError> {
let snapshot = state.config.load_full();
if query.vhost.as_ref().is_some_and(|id| {
id != "*" && !snapshot.envelope.config.vhosts.iter().any(|vhost| &vhost.id == id)
id != "*"
&& !snapshot
.envelope
.config
.vhosts
.iter()
.any(|vhost| &vhost.id == id)
}) {
return Err(ApiError(
StatusCode::NOT_FOUND,