elevenlabs-python icon indicating copy to clipboard operation
elevenlabs-python copied to clipboard

Timeout bug

Open drawnwren opened this issue 1 year ago • 1 comments

Here's the type signature of the httpx:AsyncClient.request method:

    async def request(
        self,
        method: str,
        url: URL | str,
        *,
        content: RequestContent | None = None,
        data: RequestData | None = None,
        files: RequestFiles | None = None,
        json: typing.Any | None = None,
        params: QueryParamTypes | None = None,
        headers: HeaderTypes | None = None,
        cookies: CookieTypes | None = None,
        auth: AuthTypes | UseClientDefault | None = USE_CLIENT_DEFAULT,
        follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT,
        timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT,
        extensions: RequestExtensions | None = None,
    ) -> Response:

It's important that they use a custom type to indicate that no timeout is set. When you wrap their client here:

https://github.com/elevenlabs/elevenlabs-python/blob/317b471eebfea68c70c35839a1d5c6264018446f/src/elevenlabs/core/client_wrapper.py#L63

You use None as the default timeout, and pass the default timeout value to get here: https://github.com/elevenlabs/elevenlabs-python/blob/317b471eebfea68c70c35839a1d5c6264018446f/src/elevenlabs/core/http_client.py#L352

httpx treats timeout=None as no timeout at all (not the client default timeout), and this means that we're seeing some stuck connections in our code.

drawnwren avatar Oct 08 '24 22:10 drawnwren

hey thanks for this issue and the pointer! we will ship a fix soon

AngeloGiacco avatar Feb 03 '25 18:02 AngeloGiacco