When I am on a slow connection and making a POST request, Volley retries my request multiple times and after it all ends up hitting my errorListener
. Sometimes, these retries actually succeeded in posting data.
The user will assume that the request failed, but in truth, if they refreshed the data they'd see the data was POSTed twice to the server (or however many successful retries in the bunch).
I want give Volley a very dumbed-down retry policy:
I want it to try a request for 15 seconds and if the request doesn't reach the server within 15 seconds and comes back with a response to trigger the errorListener
. I don't want it to retry at all.
The only concern is if Volley tries, the request gets to the server within 20~25 seconds, but by then it triggered the errorListener
and the data still got POSTed.
Does HTTP follow a time-limit after which it is 100% the data won't get posted because the request took too long? Like maybe 40 seconds? If such, then I can have the request go on for 40 seconds.
In all:
No retries and ensure 100% that if data got posted on first try go to successListener
and if it didn't get posted (request died due to taking too long or error response from server) errorListener
.
I was thinking of doing something with the defaultRetryPolicy... like DefaultRetryPolicy(15000, 0, 1)
, though I think the last parameter doesn't matter because what is the point of back-off with no retries.
How would I achieve what I asked two paragraphs back?