Skip to content

Change default read timeout for database account - #39596

Merged
Kushagra Thapar (kushagraThapar) merged 14 commits into
Azure:mainfrom
tvaron3:tvaron3/readtimeout
Feb 6, 2025
Merged

Kushagra Thapar (kushagraThapar) merged 14 commits into
Azure:mainfrom
tvaron3:tvaron3/readtimeout

Conversation

@tvaron3

@tvaron3 Tomas Varon (tvaron3) commented Feb 6, 2025 •

Copy link
Copy Markdown
Member

Description

  • Changed default read timeout for getDatabaseAccount calls to be 5 seconds.
  • Fixed timeout retry policy to retry on reads

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM - Thanks!

@azure-sdk

Azure SDK Bot (azure-sdk) commented Feb 6, 2025 •

Copy link
Copy Markdown
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-cosmos

@tvaron3

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I know its short notice but, would be good to have a mock test if possible.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@Pilchie

Copy link
Copy Markdown
Member

Does this include logic to retry in other regions when preferred_locations isn't set?

@tvaron3

Tomas Varon (tvaron3) commented Feb 6, 2025 •

Copy link
Copy Markdown
Member Author

Does this include logic to retry in other regions when preferred_locations isn't set?

It does not include this. Kevin Pilch (@Pilchie)

@kushagraThapar
Kushagra Thapar (kushagraThapar) merged commit 9a65e74 into Azure:main Feb 6, 2025
elif e.status_code in [StatusCodes.REQUEST_TIMEOUT, StatusCodes.SERVICE_UNAVAILABLE]:
elif e.status_code == StatusCodes.REQUEST_TIMEOUT:
retry_policy = timeout_failover_retry_policy
elif e.status_code >= StatusCodes.INTERNAL_SERVER_ERROR:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's under exceptions.CosmosHttpResponseError as e:
What if the exception is not CosmosHttpResponseError as we mentioned sometimes it's ServiceResponseError before?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In that case it falls back to below line 205 and line 212 - depending on the type of the error.
For any other error, it will always come here as long as the error is returned by http client.
I can explain more on the call (since the error flow comes from a different class).

l0lawrence pushed a commit to l0lawrence/azure-sdk-for-python that referenced this pull request Feb 19, 2025
* change default read timeout

* fix tests

* Add read timeout tests for database account calls

* fix timeout retry policy

* Fixed the timeout logic

* Fixed the timeout retry policy

* Mock tests for timeout and failover retry policy

* Fixed async tests

* Updated versions for release and changelog

* Add tests for cross region tries

---------

Co-authored-by: Kushagra Thapar <kuthapar@microsoft.com>
Co-authored-by: Kushagra Thapar <kushuthapar@gmail.com>
Rena (cRui861) pushed a commit that referenced this pull request Feb 27, 2025
* change default read timeout

* fix tests

* Add read timeout tests for database account calls

* fix timeout retry policy

* Fixed the timeout logic

* Fixed the timeout retry policy

* Mock tests for timeout and failover retry policy

* Fixed async tests

* Updated versions for release and changelog

* Add tests for cross region tries

---------

Co-authored-by: Kushagra Thapar <kuthapar@microsoft.com>
Co-authored-by: Kushagra Thapar <kushuthapar@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants