Skip to content

Commit c4fe829

Browse files
feat: add edge functions timeout (#846)
1 parent 7201089 commit c4fe829

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

supabase/_async/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ def storage(self):
191191
def functions(self):
192192
if self._functions is None:
193193
self._functions = AsyncFunctionsClient(
194-
self.functions_url, self.options.headers
194+
self.functions_url,
195+
self.options.headers,
196+
self.options.function_client_timeout,
195197
)
196198
return self._functions
197199

supabase/_sync/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ def storage(self):
191191
def functions(self):
192192
if self._functions is None:
193193
self._functions = SyncFunctionsClient(
194-
self.functions_url, self.options.headers
194+
self.functions_url,
195+
self.options.headers,
196+
self.options.function_client_timeout,
195197
)
196198
return self._functions
197199

supabase/lib/client_options.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from httpx import Timeout
66
from postgrest.constants import DEFAULT_POSTGREST_CLIENT_TIMEOUT
77
from storage3.constants import DEFAULT_TIMEOUT as DEFAULT_STORAGE_CLIENT_TIMEOUT
8+
from supafunc.utils import DEFAULT_FUNCTION_CLIENT_TIMEOUT
89

910
from supabase import __version__
1011

@@ -42,6 +43,11 @@ class ClientOptions:
4243
storage_client_timeout: Union[int, float, Timeout] = DEFAULT_STORAGE_CLIENT_TIMEOUT
4344
"""Timeout passed to the SyncStorageClient instance"""
4445

46+
function_client_timeout: Union[int, float, Timeout] = (
47+
DEFAULT_FUNCTION_CLIENT_TIMEOUT
48+
)
49+
"""Timeout passed to the SyncFunctionsClient instance."""
50+
4551
flow_type: AuthFlowType = "implicit"
4652
"""flow type to use for authentication"""
4753

0 commit comments

Comments
 (0)