diff --git a/martin/src/pg/query_tables.rs b/martin/src/pg/query_tables.rs index d67455b4..23a13c15 100644 --- a/martin/src/pg/query_tables.rs +++ b/martin/src/pg/query_tables.rs @@ -115,23 +115,35 @@ pub async fn table_to_query( if info.bounds.is_none() { match bounds_type { BoundsCalcType::Skip => {} - BoundsCalcType::Quick | BoundsCalcType::Calc => { + BoundsCalcType::Calc => { + debug!("Computing {} table bounds for {id}", info.format_id()); + info.bounds = calc_bounds(&pool, &schema, &table, &geometry_column, srid).await?; + } + BoundsCalcType::Quick => { + debug!( + "Computing {} table bounds with {}s timeout for {id}", + info.format_id(), + DEFAULT_BOUNDS_TIMEOUT.as_secs() + ); let bounds = calc_bounds(&pool, &schema, &table, &geometry_column, srid); - if bounds_type == BoundsCalcType::Calc { - info.bounds = bounds.await?; + pin_mut!(bounds); + if let Ok(bounds) = timeout(DEFAULT_BOUNDS_TIMEOUT, &mut bounds).await { + info.bounds = bounds?; } else { - pin_mut!(bounds); - if let Ok(bounds) = timeout(DEFAULT_BOUNDS_TIMEOUT, &mut bounds).await { - info.bounds = bounds?; - } else { - warn!( + warn!( "Timeout computing {} bounds for {id}, aborting query. Use --auto-bounds=calc to wait until complete, or check the table for missing indices.", info.format_id(), ); - } } } } + + if let Some(bounds) = info.bounds { + debug!( + "The computed bounds for {id} from {} are {bounds}", + info.format_id() + ); + } } let properties = if let Some(props) = &info.properties {