mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-02 02:01:47 +00:00
Replace per-request aiohttp.ClientSession() in every WhatsApp adapter method with a single persistent self._http_session, matching the pattern used by Mattermost, HomeAssistant, and SMS adapters. Changes: - Create self._http_session in connect(), close in disconnect() - All bridge HTTP calls (send, edit, send-media, typing, get_chat_info, poll_messages) now use the shared session - Explicitly cancel _poll_task on disconnect() instead of relying solely on self._running = False - Health-check sessions in connect() remain ephemeral (persistent session not yet created at that point) - Remove per-method ImportError guards for aiohttp (always available when gateway runs via [messaging] extras) Salvaged from PR #1851 by Himess. The _poll_task storage was already on main from PR #3267; this adds the disconnect cancellation and the persistent session. Tests: 4 new tests for session close, already-closed skip, poll task cancellation, and done-task skip. |
||
|---|---|---|
| .. | ||
| builtin_hooks | ||
| platforms | ||
| __init__.py | ||
| channel_directory.py | ||
| config.py | ||
| delivery.py | ||
| hooks.py | ||
| mirror.py | ||
| pairing.py | ||
| run.py | ||
| session.py | ||
| status.py | ||
| sticker_cache.py | ||
| stream_consumer.py | ||