FEATURE REQUEST:Fix EmbeddingService blocking the event loop
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 48/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- python
- 領域
- backend, performance
調査の方向性
backend/app/services/embedding_service/service.py から始め、get_embedding と get_embeddings、およびそれらの同期的な model.encode 呼び出しに注目してください。app/services/github/user/profiling.py、app/services/github/issue_processor.py、app/agents/devrel/github/tools/contributor_recommendation.py の利用側を確認してください。公開 async API が変更されず、embedding の生成中も別の async リクエストが応答可能なままであれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 103
- フォーク
- 143
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AOSSIE-Org/Devr.AI のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
AOSSIE-Org/Devr.AI#315 · コメント 1 件 ·
-
Bump Weaviate image to 1.39.13 (Go 1.26.10 / CVE-2026-111943)対応中かも @dudanogueira が 38 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
AOSSIE-Org/Devr.AI#309 · コメント 1 件 ·
-
DOCS UPDATE: Incorrect Flask command path in backend installation guide対応中かも @Ashwin-Pillai-22 が 321 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
AOSSIE-Org/Devr.AI#229 · コメント 3 件 ·
-
BUG:Devr.AI Agent loses user_profile for returning users and fails to persist conversation summaries & cumulative interaction counts対応中かも @shubhumre777 が 34 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
AOSSIE-Org/Devr.AI#311 · コメント 2 件 ·
-
BUG: Local pytest suite fails to collect due to deprecated imports and mock schemas再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
AOSSIE-Org/Devr.AI#307 · コメント 1 件 ·
AOSSIE-Org/Devr.AI の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
pimutils/vdirsyncer#1242 ·
-
priority:P2
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
QuantConnect/lean-cli#792 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
open-webui/open-webui#35360 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
Suggest link: Destiny Verify (MIT zero-dependency pre-commit security, citation & link hygiene CLI)オープン
難易度 1/5 1時間未満 初心者へのやさしさ 68/100