0.34.6_repo_cleanup

This commit is contained in:
Mateusz Gruszczyński committed 2026-10-22 09:31:15 +02:00
1 parent ce1a90397c
commit 133d2f0f91
273 files changed
+5969 -6926

No files matched your search

+31 -11
View File
@@ -79,8 +79,16 @@ async fn cache_purge(
));
}
}
let permit = state.cache_invalidation_slots.clone().try_acquire_owned()
.map_err(|_| ApiError(StatusCode::TOO_MANY_REQUESTS, "cache maintenance busy".into()))?;
let permit = state
.cache_invalidation_slots
.clone()
.try_acquire_owned()
.map_err(|_| {
ApiError(
StatusCode::TOO_MANY_REQUESTS,
"cache maintenance busy".into(),
)
})?;
let detail = format!(
"scope={}; in-flight fills invalidated",
scope.vhost.as_deref().unwrap_or("all")
@@ -98,7 +106,9 @@ async fn cache_purge(
Some(id) => cache.purge_scope(id),
None => cache.purge(None),
}
}).await.map_err(auth::internal)?;
})
.await
.map_err(auth::internal)?;
Ok(Json(
json!({"purged_entries":purged, "vhost":scope.vhost, "metrics":state.cache.view()}),
))
@@ -126,8 +136,16 @@ async fn cache_invalidate(
));
}
}
let permit = state.cache_invalidation_slots.clone().try_acquire_owned()
.map_err(|_| ApiError(StatusCode::TOO_MANY_REQUESTS, "cache maintenance busy".into()))?;
let permit = state
.cache_invalidation_slots
.clone()
.try_acquire_owned()
.map_err(|_| {
ApiError(
StatusCode::TOO_MANY_REQUESTS,
"cache maintenance busy".into(),
)
})?;
let detail = format!(
"operation={:?}; selector={:?}; vhost={}; host={}; value={:?}",
request.operation,
@@ -145,8 +163,10 @@ async fn cache_invalidate(
let result = tokio::task::spawn_blocking(move || {
let _permit = permit;
cache.invalidate(request)
}).await.map_err(auth::internal)?
.map_err(|error| ApiError(StatusCode::UNPROCESSABLE_ENTITY, error.to_string()))?;
})
.await
.map_err(auth::internal)?
.map_err(|error| ApiError(StatusCode::UNPROCESSABLE_ENTITY, error.to_string()))?;
Ok(Json(json!({
"result": result,
"metrics": state.cache.view(),
@@ -163,8 +183,6 @@ async fn cache_ban_delete(
Extension(session): Extension<Session>,
Path(id): Path<u64>,
) -> Result<Json<Value>, ApiError> {
// This is a destructive operation: fail closed if the audit store is
// unavailable, rather than removing a ban and only then trying to log it.
if !state.cache.bans().iter().any(|rule| rule.id == id) {
return Err(ApiError(
StatusCode::NOT_FOUND,
@@ -181,7 +199,10 @@ async fn cache_ban_delete(
.await
.map_err(auth::internal)?;
if !state.cache.remove_ban(id) {
return Err(ApiError(StatusCode::NOT_FOUND, "unknown cache BAN rule".into()));
return Err(ApiError(
StatusCode::NOT_FOUND,
"unknown cache BAN rule".into(),
));
}
Ok(Json(json!({"removed": id, "bans": state.cache.bans()})))
}
@@ -322,7 +343,6 @@ async fn certificate_upload(
.audit(&session.username, "certificate.upload", &certificate.id)
.await
.map_err(auth::internal)?;
// Never serialize the PEM request or any key material, including on success.
Ok(Json(json!({"certificate":certificate, "staged":true})))
}