mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(gateway): add request timeouts to HA, Email, Mattermost, SMS adapters (#3258)
Add timeout=30 to all bare ClientSession, IMAP4_SSL, smtplib.SMTP, and ws_connect calls that previously had no timeout, preventing indefinite hangs when an external server is slow or unresponsive. Adapters hardened: - HomeAssistant: REST + WS session creation, ws_connect handshake - Email: all IMAP4_SSL (x2) and smtplib.SMTP (x3) calls - Mattermost: session creation, _api_get, _api_post, _upload_file (60s) - SMS: session creation in connect() + fallback session in send() Salvaged from PRs #3161, #3168, #3170 (memosr) and #3201 (binhnt92). SMS fallback ClientSession on send() also patched (missed in #3201). Co-authored-by: memosr <memosr@users.noreply.github.com> Co-authored-by: nguyen binh <binhnt92@users.noreply.github.com>
This commit is contained in:
parent
db241ae6ce
commit
3a86328847
4 changed files with 25 additions and 14 deletions
|
|
@ -106,7 +106,9 @@ class SmsAdapter(BasePlatformAdapter):
|
|||
await self._runner.setup()
|
||||
site = web.TCPSite(self._runner, "0.0.0.0", self._webhook_port)
|
||||
await site.start()
|
||||
self._http_session = aiohttp.ClientSession()
|
||||
self._http_session = aiohttp.ClientSession(
|
||||
timeout=aiohttp.ClientTimeout(total=30),
|
||||
)
|
||||
self._running = True
|
||||
|
||||
logger.info(
|
||||
|
|
@ -144,7 +146,9 @@ class SmsAdapter(BasePlatformAdapter):
|
|||
"Authorization": self._basic_auth_header(),
|
||||
}
|
||||
|
||||
session = self._http_session or aiohttp.ClientSession()
|
||||
session = self._http_session or aiohttp.ClientSession(
|
||||
timeout=aiohttp.ClientTimeout(total=30),
|
||||
)
|
||||
try:
|
||||
for chunk in chunks:
|
||||
form_data = aiohttp.FormData()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue