set timeout for sse in httpx_client_factory (#943)
This commit is contained in:
parent
20dc0fbabb
commit
0bcecffc4c
1 changed files with 3 additions and 2 deletions
|
|
@ -54,12 +54,13 @@ async def sse_client(
|
||||||
async with anyio.create_task_group() as tg:
|
async with anyio.create_task_group() as tg:
|
||||||
try:
|
try:
|
||||||
logger.debug(f"Connecting to SSE endpoint: {remove_request_params(url)}")
|
logger.debug(f"Connecting to SSE endpoint: {remove_request_params(url)}")
|
||||||
async with httpx_client_factory(headers=headers, auth=auth) as client:
|
async with httpx_client_factory(
|
||||||
|
headers=headers, auth=auth, timeout=httpx.Timeout(timeout, read=sse_read_timeout)
|
||||||
|
) as client:
|
||||||
async with aconnect_sse(
|
async with aconnect_sse(
|
||||||
client,
|
client,
|
||||||
"GET",
|
"GET",
|
||||||
url,
|
url,
|
||||||
timeout=httpx.Timeout(timeout, read=sse_read_timeout),
|
|
||||||
) as event_source:
|
) as event_source:
|
||||||
event_source.response.raise_for_status()
|
event_source.response.raise_for_status()
|
||||||
logger.debug("SSE connection established")
|
logger.debug("SSE connection established")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue