Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Replace Synchronous HTTP Clients with Async Alternatives in AI Endpoints

Aperta
#177 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@XPE-7 ci sta già lavorando.

Dal 17/11/2025.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
fastapi, python, supabase

Direzione di ricerca

Inizia in ai.py facendo un inventario degli endpoint AI e delle relative chiamate sincrone a requests, delle query Supabase e delle chiamate esterne alle API Gemini e YouTube. Traccia come viene dichiarata ogni route e come vengono gestite le risposte. Il lavoro è completato quando gli endpoint usano alternative non bloccanti e mantengono il comportamento esistente, consentendo al contempo richieste concorrenti senza bloccare l’event loop.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
101
Fork
145
Merge medio
32m
PR unite (30g)
2

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di AOSSIE-Org/InPactAI

Tutte le issue di AOSSIE-Org/InPactAI

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.