From 46e08353fe8104c2b9aeb5cc042bae34e0e035ee Mon Sep 17 00:00:00 2001 From: Ro'e Katz Date: Mon, 30 Oct 2023 18:52:20 +0200 Subject: [PATCH] Rename ALLOWED_QUERY_TIMEOUT -> OPA_CLIENT_QUERY_TIMEOUT --- horizon/config.py | 4 ++-- horizon/enforcer/api.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/horizon/config.py b/horizon/config.py index ac53d078..dc2b3838 100644 --- a/horizon/config.py +++ b/horizon/config.py @@ -69,8 +69,8 @@ class SidecarConfig(Confi): 10, ) - ALLOWED_QUERY_TIMEOUT = confi.float( - "ALLOWED_QUERY_TIMEOUT", + OPA_CLIENT_QUERY_TIMEOUT = confi.float( + "OPA_CLIENT_QUERY_TIMEOUT", 5 * 60, # This is also aiohttp's default timeout description="the timeout for querying OPA for an allow decision, 0 means no timeout", ) diff --git a/horizon/enforcer/api.py b/horizon/enforcer/api.py index c94a6029..5743ebbd 100644 --- a/horizon/enforcer/api.py +++ b/horizon/enforcer/api.py @@ -208,7 +208,7 @@ async def post_to_opa(request: Request, path: str, data: dict): url, data=json.dumps(data) if data is not None else None, headers=headers, - timeout=sidecar_config.ALLOWED_QUERY_TIMEOUT, + timeout=sidecar_config.OPA_CLIENT_QUERY_TIMEOUT, ) as opa_response: return await proxy_response(opa_response) except asyncio.exceptions.TimeoutError: @@ -216,7 +216,7 @@ async def post_to_opa(request: Request, path: str, data: dict): status.HTTP_504_GATEWAY_TIMEOUT, detail="OPA request timed out (url: {url}, timeout: {timeout}s)".format( url=url, - timeout=sidecar_config.ALLOWED_QUERY_TIMEOUT, + timeout=sidecar_config.OPA_CLIENT_QUERY_TIMEOUT, raise_for_status=True, ), )