Git Product home page Git Product logo

Comments (3)

jpd236 avatar jpd236 commented on May 2, 2024

In general, I'd prefer to avoid a patch to BasicNetwork that attempts retries in new situations by default. However, it's fine with me if the change is reasonable and gated by something that is opt-in.

For example, you can see:

dd439dc

where we added Request#setShouldRetryServerErrors. If true, 5xx errors will be passed to the RetryPolicy as you describe. But it's not true by default, so the prior behavior is retained if you take no action.

So the above change should actually take care of retrying most instances of ServerError. The only exception I see is a 3xx "error" which is actually a redirect request, so it's not clear to me why you'd want to retry these. So does setShouldRetryServerErrors take care of your needs?

NetworkError should already be hitting any RetryPolicy implementation that is attached to the request:

https://github.com/google/volley/blob/master/src/main/java/com/android/volley/toolbox/BasicNetwork.java#L177

So AFAIK, the only possible delta you'd be asking for here would be retrying on 3xx errors... if there's a valid reason to do that, I'm willing to hear it, but it seems a bit peculiar to me.

from volley.

eliotstock avatar eliotstock commented on May 2, 2024

Thanks. I agree that it doesn't make sense to retry on 3xx errors. Actually, it's the NoConnectionError errors I was hoping to retry on, not the ServerErrors:

https://github.com/google/volley/blob/master/src/main/java/com/android/volley/toolbox/BasicNetwork.java#L151

We have an app that gathers a bunch of data on the UI from users who tend to wander around a building in which there's spotty Wi-Fi connectivity. We'd like to fire off requests to Volley safe in the knowledge that if we're not actually connected to the internet right now, we'll get a retry later on. I'd imagine that the same need would apply to consumer apps using mobile data.

Would a setShouldRetryNoConnectionErrors() flag, defaulting to off, be generally useful?

from volley.

eliotstock avatar eliotstock commented on May 2, 2024

Sorry, I realise now that the backoff implemented with the retry policy in Volley is about timeouts, not resending a request after some delay. You're waiting successively longer for a response, but you're not resending a request after some delay. It's the resend after a delay I was looking for, so I've implemented that without extending anything in Volley. Closing this.

from volley.

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.