Add a SurrealQL TIMEOUT 300ms clause to the two hand-built read queries so the engine itself stops executing once the budget is blown.
Scope
- Set
stmt.timeout on both SelectStatements:
- Search/list —
query_inner, before the debug!(sql = ...) at src/web/query.rs:228.
- Item detail —
get_item, before the debug!(sql = ...) at src/web/item.rs:283.
SelectStatement.timeout is an Expr (default Literal::None → no clause). Set it to a duration literal:
stmt.timeout = Expr::Literal(Literal::Duration(QUERY_TIMEOUT.into()));
- Share one
const QUERY_TIMEOUT: Duration (e.g. in src/web/mod.rs) across both sites.
Verify when implementing
- Confirm the concrete duration newtype inside
Literal::Duration(...) for the sql module and that Duration::into() resolves to it (surrealdb-core 3.1.2, sql/literal.rs:29).
- Assert
stmt.to_sql() contains TIMEOUT 300ms in a unit test (the get_item tests at src/web/item.rs:397 already stand up an in-memory DB to extend).
Parent: #52
Add a SurrealQL
TIMEOUT 300msclause to the two hand-built read queries so the engine itself stops executing once the budget is blown.Scope
stmt.timeouton bothSelectStatements:query_inner, before thedebug!(sql = ...)atsrc/web/query.rs:228.get_item, before thedebug!(sql = ...)atsrc/web/item.rs:283.SelectStatement.timeoutis anExpr(defaultLiteral::None→ no clause). Set it to a duration literal:const QUERY_TIMEOUT: Duration(e.g. insrc/web/mod.rs) across both sites.Verify when implementing
Literal::Duration(...)for thesqlmodule and thatDuration::into()resolves to it (surrealdb-core3.1.2,sql/literal.rs:29).stmt.to_sql()containsTIMEOUT 300msin a unit test (theget_itemtests atsrc/web/item.rs:397already stand up an in-memory DB to extend).Parent: #52