FEATURE REQUEST:Fix EmbeddingService blocking the event loop
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- backend, performance
Línea de trabajo
Comienza en backend/app/services/embedding_service/service.py, centrándote en get_embedding y get_embeddings y en sus llamadas síncronas a model.encode. Revisa los consumidores en app/services/github/user/profiling.py, app/services/github/issue_processor.py y app/agents/devrel/github/tools/contributor_recommendation.py; se considera terminado cuando la API async pública no cambia y otra solicitud async sigue respondiendo durante la generación de embeddings.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Is your feature request related to a problem?
- Yes, it is related to a problem
Describe the feature you'd like
🌟Feature Description
Offload blocking embedding work from the async event loop so that EmbeddingService does not block other concurrent requests. The service should run CPU/GPU-bound model.encode() calls in a thread pool (e.g. via asyncio.to_thread()) while keeping the public API async.
🔍 Problem Statement
EmbeddingService exposes async methods (get_embedding, get_embeddings, summarize_user_profile, search_similar_profiles) but internally calls synchronous SentenceTransformer code:
self.model.encode(...)inget_embeddingandget_embeddingsis blocking. It runs on CPU/GPU and does not yield to the event loop.- While one request is generating embeddings, the entire process is blocked: other HTTP requests, agent tools, and background tasks stall until the encode finishes.
- The LLM call in
summarize_user_profilecorrectly usesawait self.llm.ainvoke(...)and is non-blocking; only the embedding step blocks.
This hurts latency and concurrency wherever the service is used (e.g. issue_processor.py, contributor_recommendation.py, user profiling).
🎯 Expected Outcome
- Event loop stays responsive during embedding generation: other async work (API handlers, other embeddings, LLM calls) can run while
model.encode()runs in a worker thread. - No change to the public API: callers keep using
await embedding_service.get_embedding(...)andawait embedding_service.get_embeddings(...). - Implementation approach: add a synchronous helper that performs
model.encode()and tensor-to-list conversion; call it fromget_embeddingandget_embeddingsviaasyncio.to_thread()(orloop.run_in_executor()with aThreadPoolExecutor). - Optional: run model lazy-load in a thread at first use to avoid blocking on first request.
📷 Screenshots and Design Ideas
Before: One long embedding request blocks the event loop → other requests wait.
After: Embedding runs in a thread pool → event loop continues handling other requests; embedding call still awaited by the original request.
No UI changes; this is a backend concurrency fix.
📋 Additional Context
- File to change:
backend/app/services/embedding_service/service.py - Consumers:
app/services/github/user/profiling.py,app/services/github/issue_processor.py,app/agents/devrel/github/tools/contributor_recommendation.py - Suggested steps:
- Add
import asyncio. - Add a sync helper method (e.g.
_encode(texts)) that callsself.model.encode(...)and returns list(s) of floats. - In
get_embedding: replace directmodel.encodewithawait asyncio.to_thread(self._encode, [text]), then return the single embedding list. - In
get_embeddings: replace directmodel.encodewithawait asyncio.to_thread(self._encode, texts)and return the list of lists.
- Add
- Verification: While one request is generating embeddings, trigger another (e.g. health check or simple async endpoint); the second should respond without waiting for the first.
Record
- I agree to follow this project's Code of Conduct
- I want to work on implementing this feature
- Lenguaje dominante
- Python
- Estrellas
- 103
- Forks
- 143
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de AOSSIE-Org/Devr.AI
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
AOSSIE-Org/Devr.AI#315 · 1 comentario ·
-
Bump Weaviate image to 1.39.13 (Go 1.26.10 / CVE-2026-111943)Posiblemente ocupada @dudanogueira la tomó hace 38 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
AOSSIE-Org/Devr.AI#309 · 1 comentario ·
-
DOCS UPDATE: Incorrect Flask command path in backend installation guidePosiblemente ocupada @Ashwin-Pillai-22 la tomó hace 321 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
AOSSIE-Org/Devr.AI#229 · 3 comentarios ·
-
BUG:Devr.AI Agent loses user_profile for returning users and fails to persist conversation summaries & cumulative interaction countsPosiblemente ocupada @shubhumre777 la tomó hace 34 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
AOSSIE-Org/Devr.AI#311 · 2 comentarios ·
-
BUG: Local pytest suite fails to collect due to deprecated imports and mock schemasQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
AOSSIE-Org/Devr.AI#307 · 1 comentario ·
Todos los issues de AOSSIE-Org/Devr.AI
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
pimutils/vdirsyncer#1242 ·
-
priority:P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
QuantConnect/lean-cli#792 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
open-webui/open-webui#35360 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
Suggest link: Destiny Verify (MIT zero-dependency pre-commit security, citation & link hygiene CLI)Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100