Skip to content

Commit

Permalink
feat: add edge functions timeout (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
juancarlospaco authored Jul 24, 2024
1 parent 7201089 commit c4fe829
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion supabase/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion supabase/_sync/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions supabase/lib/client_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__

Expand Down Expand Up @@ -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"""

Expand Down

0 comments on commit c4fe829

Please sign in to comment.