[Cosmos] set startup to false on any refresh#40203
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR prevents unnecessary health checks by setting the startup attribute to False during endpoint refreshes. Key changes include updating the changelog to document the behavior change and modifying the async global endpoint manager to set startup to False following an endpoint refresh.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| sdk/cosmos/azure-cosmos/CHANGELOG.md | Added changelog entry documenting reduction of health checks on client startup |
| sdk/cosmos/azure-cosmos/azure/cosmos/aio/_global_endpoint_manager_async.py | Updates the refresh process to set startup to False after a successful refresh |
Comments suppressed due to low confidence (1)
sdk/cosmos/azure-cosmos/azure/cosmos/aio/_global_endpoint_manager_async.py:119
- [nitpick] Ensure that setting self.startup to False at this point is intended for all cases; if the goal is to disable health checks after startup, the logic appears correct, but consider whether a more centralized or self-documenting approach might improve clarity.
self.startup = False
|
API change check API changes are not detected in this pull request. |
kushagraThapar
left a comment
There was a problem hiding this comment.
thanks for the quick fix @simorenoh
We should think about what are the other code paths a customer could be missing if not calling the aenter() function and then fix other side effects if any.
Customers not initializing their async client manually or with a context manager can be affected by too many health checks happening for their services, adding overhead latencies to their applications by having to handle all these additional requests. This change sets the
startupattribute toFalseon the first refresh it sees asTrue, which prevents unnecessary health checks from occurring.