Code Monkey home page Code Monkey logo

Comments (3)

serbrech avatar serbrech commented on August 17, 2024

I've tried to track the logic in the .net SDK. but it's pretty hard to figure it out because it's very fragmented.

I think that it boils down to this:

https://github.com/Azure/azure-sdk-for-net/blob/c4418cd3e85f2e01a92b702414244647ff3695df/sdk/core/Azure.Core/src/Shared/OperationInternal.cs#L122C63-L122C79

and this for the failure case:
https://github.com/Azure/azure-sdk-for-net/blob/c4418cd3e85f2e01a92b702414244647ff3695df/sdk/core/Azure.Core/src/Shared/OperationInternal.cs#L237C12-L237C91

but I don't see any code that would not consider a 500 a terminal failure.

from azure-sdk-for-go.

jhendrixMSFT avatar jhendrixMSFT commented on August 17, 2024

I think the problem here is that we've conflated rules for retry with status codes we consider to be terminal failure. Off the cuff, what probably needs to happen is that for status codes that aren't terminal success, we let them be handled by the retry policy which, by default, will enforce a retry cap (need to experiment with this). We just have to ensure that we don't consider the underlying poller to be "done" in such cases.

from azure-sdk-for-go.

jhendrixMSFT avatar jhendrixMSFT commented on August 17, 2024

Ok it's more nuanced than that. For context, Poller[T].PollUntilDone() will exit IFF one of the following conditions is met.

  • the HTTP transport fails (governed by the retry policy)
  • the underlying poller reaches a terminal state
  • the context expires/is canceled

Here is the sequence of events. This assumes the default retry policy is in play.

  1. PollUntilDone calls underlying poller.Poll
  2. Poll creates the request and sends it through the pipeline
  3. Service returns 500, the retry policy retries the request until the cap is hit
  4. 500 is returned to the underlying poller which is non-terminal
  5. goto step 1

While we could augment the retry policy to tell PollUntilDone "my retry cap has been exceeded", it would tightly couple the two together which is not good (e.g. if the in-box retry policy has been replaced, now the logic is broken).

This might require updating PollUntilDone to exit after N number of transient status codes. This requires some care though as it will multiply with the number of retries from the retry policy. i.e. if the retry policy retries three times on 500, and PollUntilDone retries three times on 500, the total number of requests will be nine (with exponential back-off from the retry policy to boot).

from azure-sdk-for-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.