From c4fe829430fe04053010cf5faf564dbd484378fa Mon Sep 17 00:00:00 2001 From: Juan Carlos Date: Wed, 24 Jul 2024 10:58:45 -0300 Subject: [PATCH] feat: add edge functions timeout (#846) --- supabase/_async/client.py | 4 +++- supabase/_sync/client.py | 4 +++- supabase/lib/client_options.py | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/supabase/_async/client.py b/supabase/_async/client.py index 79c8eccd..062155de 100644 --- a/supabase/_async/client.py +++ b/supabase/_async/client.py @@ -191,7 +191,9 @@ def storage(self): def functions(self): if self._functions is None: self._functions = AsyncFunctionsClient( - self.functions_url, self.options.headers + self.functions_url, + self.options.headers, + self.options.function_client_timeout, ) return self._functions diff --git a/supabase/_sync/client.py b/supabase/_sync/client.py index c26987d3..527b030c 100644 --- a/supabase/_sync/client.py +++ b/supabase/_sync/client.py @@ -191,7 +191,9 @@ def storage(self): def functions(self): if self._functions is None: self._functions = SyncFunctionsClient( - self.functions_url, self.options.headers + self.functions_url, + self.options.headers, + self.options.function_client_timeout, ) return self._functions diff --git a/supabase/lib/client_options.py b/supabase/lib/client_options.py index fa75b2ca..d0191f2c 100644 --- a/supabase/lib/client_options.py +++ b/supabase/lib/client_options.py @@ -5,6 +5,7 @@ from httpx import Timeout from postgrest.constants import DEFAULT_POSTGREST_CLIENT_TIMEOUT from storage3.constants import DEFAULT_TIMEOUT as DEFAULT_STORAGE_CLIENT_TIMEOUT +from supafunc.utils import DEFAULT_FUNCTION_CLIENT_TIMEOUT from supabase import __version__ @@ -42,6 +43,11 @@ class ClientOptions: storage_client_timeout: Union[int, float, Timeout] = DEFAULT_STORAGE_CLIENT_TIMEOUT """Timeout passed to the SyncStorageClient instance""" + function_client_timeout: Union[int, float, Timeout] = ( + DEFAULT_FUNCTION_CLIENT_TIMEOUT + ) + """Timeout passed to the SyncFunctionsClient instance.""" + flow_type: AuthFlowType = "implicit" """flow type to use for authentication"""