diff --git a/openapi.yaml b/openapi.yaml index 41da84daa..1108a26c2 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -774,6 +774,14 @@ paths: type: integer default: 1800 minimum: 0 + + - name: timeout + in: query + required: false + description: Optional. Query timeout in seconds. + schema: + type: integer + minimum: 0 responses: '200': description: routing result diff --git a/src/endpoints/routing.cc b/src/endpoints/routing.cc index a9b96b242..a868da0ca 100644 --- a/src/endpoints/routing.cc +++ b/src/endpoints/routing.cc @@ -586,7 +586,9 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const { auto const r = n::routing::raptor_search( *tt_, rtt, *search_state, *raptor_state, std::move(q), query.arriveBy_ ? n::direction::kBackward : n::direction::kForward, - std::nullopt); + query.timeout_.has_value() + ? std::optional{*query.timeout_} + : std::nullopt); return { .debugOutput_ = join(std::move(query_stats), r.search_stats_.to_map(),