mcxiaoke / android-volley

DEPRECATED
4.29k stars 1.56k forks source link

how to set the retry disable? #129

Open autoool opened 8 years ago

autoool commented 8 years ago

Hi, I have a project which use volley to post data to server. It work well, but I meet a problem that double request. When asicNetwork.logSlowRequests exception happened, request always retry. It lead to the server save the data which the client post twice. So , the data which server saved is wrong. How to set the retry disable? Can you give me your e-mail? It will make me contact you by email. Thank you!

sepbehroozi commented 8 years ago

Hi you can use this:

yourRequest.setRetryPolicy(new DefaultRetryPolicy());

this will set timeout to 2500ms, maxRetries to 0 and backoffMultiplier to 1.0f. you can customize retry policy with the other constructor

yourRequest.setRetryPolicy(new DefaultRetryPolicy(initialTimeoutMs, maxNumRetries, backoffMultiplier));