Skip to content

Cache OpenSearch version to avoid redundant HTTP calls per tool invocation#202

Open
ShivaniNR wants to merge 1 commit intoopensearch-project:mainfrom
ShivaniNR:fix/185-cache-opensearch-version
Open

Cache OpenSearch version to avoid redundant HTTP calls per tool invocation#202
ShivaniNR wants to merge 1 commit intoopensearch-project:mainfrom
ShivaniNR:fix/185-cache-opensearch-version

Conversation

@ShivaniNR
Copy link
Copy Markdown

Description

Cache the OpenSearch cluster version after the first successful retrieval to eliminate the redundant HTTP call made by get_opensearch_version() on every tool invocation. Previously, each tool call made 2 HTTP round-trips (version check + actual operation); now, subsequent calls return the cached version.

  • Add _version_cache module-level dict in helper.py keyed by cluster name
  • Add clear_version_cache() for cache reset
  • Add autouse conftest fixture to prevent cache leaking between tests
  • Add 4 tests covering cache hit, per-cluster isolation, failure retry, and cache clearing

Issues Resolved

Closes #185

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…nvocation (opensearch-project#185)

Signed-off-by: Shivani Rupnawar <shivani.n.rupnawar@gmail.com>
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.

[BUG] Tools take a long time to respond

1 participant