Skip to content

perf(issue-discovery): pool HTTP connections across scan_closed_issues round #696

@bitloi

Description

@bitloi

Summary

execute_graphql_query in gittensor/utils/github_api_tools.py uses top-level requests.post calls, so every invocation pays a fresh TCP + TLS handshake to api.github.com. This affects all GraphQL callers, including find_solver_from_cross_references_search_issue_referencing_prs_graphqlexecute_graphql_query.

Proposed improvement:

  • Add an optional session: Optional[requests.Session] = None parameter to execute_graphql_query, _search_issue_referencing_prs_graphql, and find_solver_from_cross_references.
  • When a session is provided, use session.post(...) instead of requests.post(...) so urllib3 reuses the underlying connection pool.
  • Default None preserves all existing callers and tests unchanged; this is a transport-layer optimization only.

Motivation

Any hot path that issues multiple GraphQL calls per round (issue discovery, solver lookups, etc.) benefits from connection reuse. Session pooling would:

  • Reduce repeated TCP/TLS setup overhead per call.
  • Improve wall-clock latency stability under load.
  • Lower avoidable CPU/network overhead without changing scoring logic.

This is complementary to #687, which applies the same pooling idea to the OSS miner-scoring path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions