Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed connection closing prematurely in index.py #140

Merged
merged 3 commits into from
Jan 6, 2025
Merged

Conversation

pk-zipstack
Copy link
Contributor

What

Fix for premature connection closure in vector database queries affecting Qdrant and Weaviate integrations.

Why

The vector database connection was being closed too early due to a misplaced finally block, causing query attempts to fail with "Cannot send a request, as the client has been closed" errors. This was affecting prompt execution in both prompt studio.

How

  • Removed the redundant finally block that was closing the connection prematurely
  • Consolidated error handling into a single try-except-finally block
  • Ensured the vector database connection remains open throughout the query execution
  • Moved connection cleanup to a single finally block at the end of the function

All the above changes are made in index.py

Relevant Docs

Related Issues or PRs

Dependencies Versions / Env Variables

Notes on Testing

...

Screenshots

...

Checklist

I have read and understood the Contribution Guidelines.

@CLAassistant
Copy link

CLAassistant commented Jan 4, 2025

CLA assistant check
All committers have signed the CLA.

Modifed the single try-except block into two enclosed by a parent try except block

Signed-off-by: Praveen Kumar <[email protected]>
Copy link
Contributor

@gaya3-zipstack gaya3-zipstack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added one minor suggestion. Otherwise looks good

Signed-off-by: Praveen Kumar <[email protected]>
Copy link
Contributor

@chandrasekharan-zipstack chandrasekharan-zipstack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - left a minor comment to improve readability

src/unstract/sdk/index.py Show resolved Hide resolved
@ritwik-g ritwik-g merged commit 7758532 into main Jan 6, 2025
1 check passed
@ritwik-g ritwik-g deleted the fix/db_client branch January 6, 2025 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants