Skip to content

Commit

Permalink
Add session_pool_timeout to ConnectionConfig, use it in pool ar…
Browse files Browse the repository at this point in the history
…g to `httpx.Timeout`
  • Loading branch information
tsmith023 committed Oct 16, 2024
1 parent e50463e commit 8d41cb7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions weaviate/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class ConnectionConfig:
session_pool_connections: int = 20
session_pool_maxsize: int = 100
session_pool_max_retries: int = 3
session_pool_timeout: int = 5

def __post_init__(self) -> None:
if not isinstance(self.session_pool_connections, int):
Expand All @@ -23,6 +24,10 @@ def __post_init__(self) -> None:
raise TypeError(
f"session_pool_max_retries must be {int}, received {type(self.session_pool_max_retries)}"
)
if not isinstance(self.session_pool_timeout, int):
raise TypeError(
f"session_pool_timeout must be {int}, received {type(self.session_pool_timeout)}"
)


# used in v3 only
Expand Down
4 changes: 3 additions & 1 deletion weaviate/connect/v4.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,9 @@ def __get_timeout(
timeout = self.timeout_config.query
elif method == "POST" and not is_gql_query:
timeout = self.timeout_config.insert
return Timeout(timeout=5.0, read=timeout)
return Timeout(
timeout=5.0, read=timeout, pool=self.__connection_config.session_pool_timeout
)

async def __send(
self,
Expand Down

0 comments on commit 8d41cb7

Please sign in to comment.