AOSSIE-Org / AOSSIE-Org/Devr.AI

ENHANCEMENT:Weaviate client connects and disconnects causing latency issues

Đang mở
#227 2 bình luận 0 reaction 1 người được giao Được @vaishcodescape nhận Xem trên GitHub
enhancement
Ngôn ngữ chính
Python
Star
102
Fork
137
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.