-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Configurable client requests timeout #501
Comments
Idk it is the best way to do so. There are plenty of configuration options. At least three were asked already: retry policy, proxy, and timeout. And for now, the best way to configure it is to make a simple inherit from the class. Like this: #467 (comment) |
Are you talking about InvokeTimeoutError? I get that a lot. |
Yes, this is the exception that bubbles up when
That sounds good, as long as it is easy to inherit from import asyncio
import httpx
from atproto import AsyncClient
from atproto_client.request import AsyncRequest
class CustomAsyncRequest(AsyncRequest):
def __init__(self) -> None:
super().__init__()
# Here just customise whatever the user needs
self._client = httpx.AsyncClient(follow_redirects=True, timeout=10.0)
async def foo():
client = AsyncClient(request=CustomAsyncRequest())
...
asyncio.run(foo()) Alternatively, if all the configuration needed was in the httpx client, we could just pass one as a import asyncio
import httpx
from atproto import AsyncClient
async def foo():
custom_client = httpx.AsyncClient(follow_redirects=True, timeout=10.0)
client = AsyncClient(client=custom_client)
...
asyncio.run(foo()) |
Similar to this issue, but not quite the same, as it's in a different part of the project:
Essentially when doing a large number of async request I'm seeing a lot of timeouts and increasing the httpx default timeout (via the httpx timeout constructor parameter) resolves it:
atproto/packages/atproto_client/request.py
Line 173 in d85a59f
Would it be possible to provide a user-configurable
timeout
parameteratproto.Client
/AsynClient
as well, that is passed tohttpx
?The text was updated successfully, but these errors were encountered: