In one of my application, I am sending request to server using volley
provided by Google.
Problem : Timeout and error object is null on onErrorResponse(VolleyError error)
What i have tried so far :
1) First I got null error object so solved it by using below code :
@Override
protected void deliverResponse(String response) {
super.deliverResponse(response);
}
@Override
public void deliverError(VolleyError error) {
super.deliverError(error);
DebugLog.e("deliverResponse", "getNetworkTimeMs : " + error.getNetworkTimeMs());
}
So far I have got that there is timeout
happening when I got error object null
.
2) Now Application is for Android
and iOS
and web
but timeout
happens only for Android
.
Volley log for requests :
BasicNetwork.logSlowRequests: HTTP response for request
Edited Note :
Web services develoed at server end is same for all three instances (Android , Web and iOS).
Timeout
happens when too many users makes requests to the server.
I have set time out to 2 minutes though volley throws timeout in 30 seconds only sometimes.
I have many answers to change server but as it is not possible so any other solution please.
I also like to add that if i can get more information about when timeout can be possible in volley ?
References I have been gone through :
Optimizing Volley
httpclient-often-times-out-using-wifi-is-going-fine-with-3g
long_xmlhttprequest_ajax_requests_timeout_on_android
Edited :
I have also set retry policy as below:
request.setRetryPolicy(new DefaultRetryPolicy(DefaultRetryPolicy.DEFAULT_TIMEOUT_MS * 48,
0, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
And also i do not want to retry if connection timeout.
How can i make efficient service call that can solve problem for timeout
.
Any help will be appriciated.
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…