Skip to content

Commit

Permalink
add timeout option
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Dec 10, 2024
1 parent 7894e98 commit 0cb0e1b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/endpoints/routing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::chrono::seconds>{*query.timeout_}
: std::nullopt);

return {
.debugOutput_ = join(std::move(query_stats), r.search_stats_.to_map(),
Expand Down

0 comments on commit 0cb0e1b

Please sign in to comment.