mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-08 04:42:11 +02:00
fix: propagate api-gateway --timeout flag to per-service dispatchers
The api-gateway accepts a --timeout flag (default 600) but the value is silently dropped before reaching per-service dispatchers. The flag is correctly wired to EndpointManager but DispatcherManager constructs every dispatcher (graph-rag, document-rag, text-completion, embeddings, etc.) with a hardcoded timeout=120. Changes: - Add timeout parameter to DispatcherManager.__init__ (default 120 for backward compatibility) - Replace two hardcoded timeout=120 with self.timeout in invoke_global_service() and invoke_flow_service() - Pass timeout=self.timeout from Api to DispatcherManager in service.py Fixes: #894
This commit is contained in:
parent
142dd0231c
commit
6075b78515
2 changed files with 13 additions and 3 deletions
|
|
@ -135,13 +135,19 @@ class DispatcherWrapper:
|
|||
class DispatcherManager:
|
||||
|
||||
def __init__(self, backend, config_receiver, auth,
|
||||
prefix="api-gateway", queue_overrides=None):
|
||||
prefix="api-gateway", queue_overrides=None,
|
||||
timeout=120):
|
||||
"""
|
||||
``auth`` is required. It flows into the Mux for first-frame
|
||||
WebSocket authentication and into downstream dispatcher
|
||||
construction. There is no permissive default — constructing
|
||||
a DispatcherManager without an authenticator would be a
|
||||
silent downgrade to no-auth on the socket path.
|
||||
|
||||
``timeout`` is the API request timeout in seconds for
|
||||
per-service dispatchers. Must be propagated from the
|
||||
gateway ``--timeout`` flag; defaults to 120 for backward
|
||||
compatibility with callers that do not pass the argument.
|
||||
"""
|
||||
if auth is None:
|
||||
raise ValueError(
|
||||
|
|
@ -159,6 +165,9 @@ class DispatcherManager:
|
|||
# identity out-of-band.
|
||||
self.auth = auth
|
||||
|
||||
# Timeout for per-service dispatcher requests.
|
||||
self.timeout = timeout
|
||||
|
||||
# Store queue overrides for global services
|
||||
# Format: {"config": {"request": "...", "response": "..."}, ...}
|
||||
self.queue_overrides = queue_overrides or {}
|
||||
|
|
@ -291,7 +300,7 @@ class DispatcherManager:
|
|||
|
||||
dispatcher = global_dispatchers[kind](
|
||||
backend = self.backend,
|
||||
timeout = 120,
|
||||
timeout = self.timeout,
|
||||
consumer = consumer_name,
|
||||
subscriber = consumer_name,
|
||||
request_queue = request_queue,
|
||||
|
|
@ -448,7 +457,7 @@ class DispatcherManager:
|
|||
backend = self.backend,
|
||||
request_queue = qconfig["request"],
|
||||
response_queue = qconfig["response"],
|
||||
timeout = 120,
|
||||
timeout = self.timeout,
|
||||
consumer = f"{self.prefix}-{workspace}-{flow}-{kind}-request",
|
||||
subscriber = f"{self.prefix}-{workspace}-{flow}-{kind}-request",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ class Api:
|
|||
prefix = "gateway",
|
||||
queue_overrides = queue_overrides,
|
||||
auth = self.auth,
|
||||
timeout = self.timeout,
|
||||
)
|
||||
|
||||
self.endpoint_manager = EndpointManager(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue