AOSSIE-Org / AOSSIE-Org/Devr.AI

ENHANCEMENT:Weaviate client connects and disconnects causing latency issues

未关闭
#227 2 条评论 0 个 reaction 已指派 1 人 已被 @vaishcodescape 认领 在 GitHub 查看
enhancement
主要语言
Python
星标
102
派生
137
PR 合并指标
30 天内没有已合并 PR

描述

### Is there an existing issue for this?

- [x] I have searched the existing issues

### What happened?

## 📌 Issue Overview
The Weaviate backend client repeatedly connects and disconnects on every database operation instead of reusing a persistent connection, causing unnecessary performance overhead.

## 🔍 Root Cause
- `get_weaviate_client()` calls `await client.connect()` on entry and `await client.close()` on exit
- All Weaviate operations use `async with get_weaviate_client()`, triggering a full connect/disconnect cycle per request
- This occurs despite having a global client instance

## 🚨 Actual Behavior
- A new connection is established for **every** operation
- The connection is closed immediately after use
- No connection pooling or reuse
- Adds ~10–50ms latency per query
- Wastes resources and becomes a scalability bottleneck under load

```python
@asynccontextmanager
async def get_weaviate_client():
client = get_client()
try:
await client.connect() # connects every time
yield client
finally:
await client.close() # disconnects every time
```
## Record

- [x] I agree to follow this project's Code of Conduct
- [x] I want to work on this issue

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。