Git Product home page Git Product logo

Comments (4)

jhendrixMSFT avatar jhendrixMSFT commented on September 28, 2024

Agreed that for a canceled context we should return context.Canceled. For context.DeadlineExceeded this might lead to ambiguities. Assuming that the sender's mux isn't abnormally blocked, failing to write to s.transfers would indicate that the peer doesn't have any credit, so I don't think we want to paper over that.

from go-amqp.

serbrech avatar serbrech commented on September 28, 2024

failing to write to s.transfers would indicate that the peer doesn't have any credit, so I don't think we want to paper over that.

if this is a legitimate case, you would still want to fail matching the deadline provided on the context.
not block indefinitely there. At which point do you return an error that knows for sure that it's because the peer doesn't have any credit? it should know that before the deadline, And return an appropriate error. but if you do reach the deadline, it should always be correct to return DeadlineExceeded.

from go-amqp.

jhendrixMSFT avatar jhendrixMSFT commented on September 28, 2024

We won't block indefinitely if there's no credit. We'll return an *amqp.Error instead of a context.DeadlineExceeded error.

You bring up a good point about knowing ahead of time if there's enough credit. I'll take a look at that.

from go-amqp.

jhendrixMSFT avatar jhendrixMSFT commented on September 28, 2024

Thinking about this more. The lack of credit should be temporal. So, I'm hesitant to just outright fail the transfer as that could be racy (i.e. the flow frame is in flight with credit, we just haven't received/processed it yet).

There is a bit of ambiguity though. There are two places where the sender waits on ctx.Done(). The one we're discussing here and waiting for message settlement. Is it important to be able to distinguish between the two cases? i.e. in the former (no credit), should apps retry sending the message? Should they retry sending if we cancel/time out waiting for message settlement?

Maybe I'm overthinking all of this and just returning ctx.Err() is good enough.

from go-amqp.

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.