Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Replace Synchronous HTTP Clients with Async Alternatives in AI Endpoints

Open
#177 3 comments 0 reactions 0 assignees View on GitHub

@XPE-7 is already working on this.

Since Nov 17, 2025.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
fastapi, python, supabase

Research direction

Start in ai.py by inventorying the AI endpoints and their synchronous requests calls, Supabase queries, and external Gemini and YouTube API calls. Trace how each route is declared and how responses are handled. Done means the endpoints use non-blocking alternatives and preserve their existing behavior while allowing concurrent requests without blocking the event loop.

Written by the indexing model from the issue text.

Description

Problem Description

The AI endpoints in ai.py currently use synchronous HTTP libraries (requests) within async FastAPI route handlers. This creates a performance bottleneck that significantly impacts the application's ability to handle concurrent requests efficiently.

Current problematic patterns:

# Blocking synchronous calls in async context
@router.get("/api/trending-niches")
def trending_niches():  # Should be async
    resp = requests.get(url, timeout=10)  # Blocks event loop
    supabase.table("trending_niches").select("*").execute()  # Also synchronous
Performance Impact
  • Event Loop Blocking: Synchronous HTTP calls block the entire event loop, preventing other requests from being processed
  • Thread Pool Exhaustion: FastAPI falls back to thread pool execution (limited to 40 threads by default)
  • Poor Scalability: Application cannot efficiently handle concurrent AI requests
  • Increased Latency: Context switching overhead between threads adds unnecessary delays
  • Resource Waste: Thread pool threads remain blocked during network I/O operations
Expected Behavior

AI endpoints should use non-blocking, async HTTP clients that allow the event loop to process other requests while waiting for external API responses (Gemini AI, YouTube API, Supabase).

Additional Context

This enhancement aligns with FastAPI's async-first architecture and is crucial for production deployments. The change will unlock the application's true concurrent processing potential, especially important for AI endpoints that involve multiple external API calls.

Dominant language
TypeScript
Stars
101
Forks
145
PR merge metrics
No merged PRs in 30d

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AOSSIE-Org/InPactAI

All issues in AOSSIE-Org/InPactAI

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.