Skip to content

HTTP/2 Configurable Timeout to avoid socket.timeout error #120

@Robbie-Palmer

Description

@Robbie-Palmer

I am getting a socket timeout error on calling inserts_stream, and I am unable to increase the default socket timeout
The timeout parameter in KSQLAPI's constructor does not affect inserts_stream

timeout is used to construct a SimplifiedAPI object
This is only used in the parent class BaseApi in its _request function, which uses HTTP/1 with urllib
These HTTP/1 calls are used by the query and ksql functions

The timeout is not used by HTTP/2 calls
The HTTP/2 calls depend on Hyper, which had an issue requesting support for timeouts, but it appears it wasn't addressed before the repo was deprecated
This affects the inserts_stream function and query when use_http2=True

Due to hyper's deprecation it is advised to migrate to httpx which is discussed in #102
This was started but abandoned in #107
This was published to pypi as https://pypi.org/project/pykSQL/0.11.0/, but it doesn't work as calling inserts_stream causes a bad request from ksql saying '{"@type":"generic_error","error_code":40004,"message":"This endpoint is only available when using HTTP2"}'

If the migration to httpx is completed, then it is simple to pass the same timeout for HTTP/2 requests as httpx supports this
response = httpx.post(url, data=row, headers=headers, timeout=self.timeout)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions