Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a higher timeout for httpx client #31

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions upstash_vector/client.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from httpx import Client, AsyncClient
from typing import Any
from os import environ
from typing import Any

import httpx

from upstash_vector.core.index_operations import IndexOperations, AsyncIndexOperations
from upstash_vector.http import (
execute_with_parameters,
execute_with_parameters_async,
generate_headers,
)
from upstash_vector.core.index_operations import IndexOperations, AsyncIndexOperations


class Index(IndexOperations):
Expand All @@ -32,7 +33,12 @@ def __init__(
self, url: str, token: str, retries: int = 3, retry_interval: float = 1.0
):
self._url = url
self._client = Client()
self._client = httpx.Client(
timeout=httpx.Timeout(
timeout=120.0,
connect=10.0,
)
)
self._retries = retries
self._retry_interval = retry_interval
self._headers = generate_headers(token)
Expand Down Expand Up @@ -89,7 +95,12 @@ def __init__(
):
self._url = url
self._headers = generate_headers(token)
self._client = AsyncClient()
self._client = httpx.AsyncClient(
timeout=httpx.Timeout(
timeout=120.0,
connect=10.0,
)
)
self._retries = retries
self._retry_interval = retry_interval

Expand Down
Loading