Can't even keep track anymore

This commit is contained in:
Andras Schmelczer 2026-02-13 09:16:28 +00:00
parent dccc1e439d
commit 3a3f899ea2
50 changed files with 1144 additions and 560 deletions

View file

@ -135,7 +135,8 @@ pub async fn get_hexagons(
params.filters.as_deref(),
&state.feature_name_to_index,
&state.data.enum_values,
);
)
.map_err(|err| (StatusCode::BAD_REQUEST, err))?;
let num_filters = parsed_filters.len() + parsed_enum_filters.len();
let field_indices = parse_field_indices(params.fields.as_deref(), &state.feature_name_to_index);
@ -147,7 +148,7 @@ pub async fn get_hexagons(
.map(parse_destination)
.transpose()
.map_err(|e| (StatusCode::BAD_REQUEST, e))?;
let mode = params.mode.clone().unwrap_or_else(|| "transit".into());
let mode = params.mode.clone().unwrap_or_else(|| "car".into());
// Capture what we need for the R5 call before moving state into spawn_blocking
let r5_url = state.r5_url.clone();
@ -249,16 +250,16 @@ pub async fn get_hexagons(
.map_err(|error| (StatusCode::INTERNAL_SERVER_ERROR, error.to_string()))?
.map_err(|error| (StatusCode::INTERNAL_SERVER_ERROR, error))?;
// If a destination was requested and R5 is configured, fetch travel times
// If a destination was requested and R5 is configured, fetch travel times.
if let Some(dest) = destination {
if r5_url.is_empty() {
return Err((
StatusCode::SERVICE_UNAVAILABLE,
"Travel time queries require R5 service (R5_URL not configured)".into(),
"Travel time queries require routing service (R5_URL not configured)".into(),
));
}
// Collect hex centroids from the response
// Collect hex centroids
let origins: Vec<[f64; 2]> = response
.features
.iter()
@ -297,8 +298,7 @@ pub async fn get_hexagons(
);
}
Err(err) => {
warn!("R5 travel time query failed, returning hexagons without travel_time: {}", err);
// Don't fail the whole request — just omit travel_time
warn!("Travel time query failed, returning hexagons without travel_time: {}", err);
}
}
}