Skip to content

Add close() to GraphitiClient and make HTTP timeout configurable #17

@hocinehacherouf

Description

@hocinehacherouf

Problem

GraphitiClient has two issues:

  1. 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.

  2. 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

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions