feat(enhancement): implement persistent connection management to prevent auto connect/disconnect#233
feat(enhancement): implement persistent connection management to prevent auto connect/disconnect#233vaishcodescape wants to merge 4 commits intoAOSSIE-Org:mainfrom
Conversation
…nce Tailwind CSS configuration for improved styling
…xt and cleanup on shutdown
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis PR addresses the Weaviate client connection lifecycle issue by implementing persistent connections with explicit startup/shutdown handling, introduces a reusable Button component with animation effects, and significantly enhances the landing page UI with modern animations, design tokens, and styling improvements. Changes
Sequence DiagramssequenceDiagram
actor FastAPI
participant WeaviateClient as Weaviate Client Module
participant WeaviateService as Weaviate Service
rect rgb(200, 150, 255)
Note over FastAPI,WeaviateService: Old Behavior (Per Request)
FastAPI->>WeaviateClient: get_weaviate_client()
WeaviateClient->>WeaviateService: connect()
WeaviateClient->>FastAPI: yield client
FastAPI->>WeaviateService: query/operation
WeaviateService-->>FastAPI: result
FastAPI->>WeaviateClient: exit context
WeaviateClient->>WeaviateService: close()
Note over FastAPI,WeaviateService: ⚠️ Repeated per request = latency
end
rect rgb(150, 200, 150)
Note over FastAPI,WeaviateService: New Behavior (Persistent)
FastAPI->>WeaviateClient: ensure_connected()
alt Connection exists
WeaviateClient-->>FastAPI: reuse existing
else First connection
WeaviateClient->>WeaviateService: connect() [once]
WeaviateService-->>WeaviateClient: connected
end
FastAPI->>WeaviateService: query/operation
WeaviateService-->>FastAPI: result
Note over FastAPI,WeaviateService: ✓ Connection reused across requests
FastAPI->>WeaviateClient: close_weaviate_client() [on shutdown]
WeaviateClient->>WeaviateService: close() [once]
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (10)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #227
📝 Description
This PR fixes the issue where the Weaviate client automatically connects and disconnects when the LLM gives a response. The previous implementation was creating a new connection and closing it on every request, which was inefficient and could cause performance issues
🔧 Changes Made
_connectedflag andensure_connected()to reuse active connectionsget_weaviate_client()to avoid closing connections per requestclose_weaviate_client()for graceful shutdown cleanup%formattingbackend/main.py)📷 Screenshots or Visual Changes (if applicable)
None
🤝 Collaboration
None
✅ Checklist
Summary by CodeRabbit
New Features
Improvements
Chores
✏️ Tip: You can customize this high-level summary in your review settings.