Skip to content

Commit

Permalink
fix(openai): asyncio.TimeoutError should also raise HTTPTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
zhudotexe committed Jan 16, 2024
1 parent 7db107d commit 377be69
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kani/engines/httpclient.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import abc
import asyncio
import logging

import aiohttp
Expand Down Expand Up @@ -48,7 +49,7 @@ async def request(self, method: str, route: str, **kwargs) -> aiohttp.ClientResp
# hydrate the response body into cache; this allows reading the response after exiting the context
# https://stackoverflow.com/questions/68693855/aiohttp-getting-response-object-out-of-context-manager
await resp.read()
except aiohttp.ServerTimeoutError as e:
except (asyncio.TimeoutError, aiohttp.ServerTimeoutError) as e:
self.logger.warning(f"Request timeout: {method} {self.SERVICE_BASE}{route}")
raise HTTPTimeout() from e
return resp
Expand Down

0 comments on commit 377be69

Please sign in to comment.