mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-28 16:49:58 -07:00
global: snapshot
This commit is contained in:
@@ -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(¶ms);
|
||||
let vecs = interface.search(¶ms)?;
|
||||
|
||||
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
|
||||
|
||||
@@ -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") }),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user