global: snapshot

This commit is contained in:
nym21
2025-09-03 18:17:25 +02:00
parent 1c2afd14dd
commit 3359dfcc29
55 changed files with 3213 additions and 2769 deletions

View File

@@ -16,7 +16,7 @@ use crate::{HeaderMapExtended, ResponseExtended};
use super::AppState;
const MAX_WEIGHT: usize = 320_000;
const MAX_WEIGHT: usize = 65 * 10_000;
pub async fn handler(
uri: Uri,
@@ -43,7 +43,7 @@ fn req_to_response_res(
interface, cache, ..
}: AppState,
) -> Result<Response> {
let vecs = interface.search(&params);
let vecs = interface.search(&params)?;
if vecs.is_empty() {
return Ok(Json(vec![] as Vec<usize>).into_response());
@@ -61,9 +61,9 @@ fn req_to_response_res(
.sum::<usize>();
if weight > MAX_WEIGHT {
return Err(Error::Str(
"Request is too heavy, max weight is {MAX_WEIGHT} bytes",
));
return Err(Error::String(format!(
"Request is too heavy, max weight is {MAX_WEIGHT} bytes"
)));
}
// TODO: height should be from vec, but good enough for now

View File

@@ -106,16 +106,6 @@ impl ApiRoutes for Router<AppState> {
},
),
)
.route(
"/health",
get(|| async {
Json(serde_json::json!({
"status": "healthy",
"service": "brk-server",
"timestamp": jiff::Timestamp::now().to_string()
}))
}),
)
.route(
"/api",
get(|| async {
@@ -124,9 +114,5 @@ impl ApiRoutes for Router<AppState> {
)
}),
)
.route(
"/discord",
get(|| async { Redirect::temporary("https://discord.com/invite/HaR3wpH3nr") }),
)
}
}