Problem
GraphitiClient has two issues:
-
Connection leak — The httpx.AsyncClient is created lazily but never closed. Hooks (session_start, session_end, _ingest_worker) create a new client per invocation and never release connections.
-
Hardcoded timeout — The HTTP timeout is hardcoded to 60s with no way to override it. Users behind slow networks or corporate proxies may need to tune this.
Proposed changes
- Add
timeout parameter to GraphitiClient.__init__
- Add
close() method and async context manager (async with) support
- Add
GRAPHITI_TIMEOUT env var to Settings
- Update all hooks to use
async with GraphitiClient(...) as client:
- Add unit tests for timeout, close, and context manager
Problem
GraphitiClienthas two issues:Connection leak — The
httpx.AsyncClientis created lazily but never closed. Hooks (session_start,session_end,_ingest_worker) create a new client per invocation and never release connections.Hardcoded timeout — The HTTP timeout is hardcoded to 60s with no way to override it. Users behind slow networks or corporate proxies may need to tune this.
Proposed changes
timeoutparameter toGraphitiClient.__init__close()method and async context manager (async with) supportGRAPHITI_TIMEOUTenv var toSettingsasync with GraphitiClient(...) as client: