Skip to content

Python: close the RedisContextProvider index connection when the provider owns it - #9510

Open
Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
microsoft:mainfrom
ManoharPaturi:fix/redis-context-provider-close
Open

Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
microsoft:mainfrom
ManoharPaturi:fix/redis-context-provider-close

Conversation

@ManoharPaturi

@ManoharPaturi Manohar Paturi (ManoharPaturi) commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Motivation & Context

A provider built from only a redis_url creates an index that owns a connection pool, but the context manager exit was a no-op and there was no aclose, so the pool was never released. RedisHistoryProvider in the same package already models the right rule: close what you own, leave borrowed clients alone.

Description & Review Guide

  • What are the major changes? The provider remembers whether it built the index, gains an aclose that closes the index client in that case, and the context manager exit calls it.
  • What is the impact of these changes? Providers constructed from a URL now release their connections on exit. Providers receiving an injected index change nothing, which keeps callers who share a client across providers working.
  • What do you want reviewers to focus on? The ownership flag mirrors _owns_client in the history provider, and the test exercises both ownership modes against the same connection.

Related Issue

Fixes #9509

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

…ider owns it

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
github-app-auth — 6cadc44f Deployed Oct 18, 2026 by ManoharPaturi via add_label #25693
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: RedisContextProvider never closes the index connection it creates

1 participant