orhanobut / wasp

Compact and easy to use, 'all-in-one' android network solution

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error 0, what does exactly mean?

cutiko opened this issue · comments

Greetings

At first I thought error 0 was no internet connection cause I had it when I test my app in offline mode.
But now Im getting while connected to internet.

What does error 0 actually means?

Greetings

After a lot of debugging we figure it out what erro 0 ment in our case, it means:

java.net.SocketTimeoutException

We found out about it using AppDynamics. I dont recommend app dynamics at all, my compile time when from 7 seconds to 1 min and a half when added, but at least, we now know what it is.

There is another part on this problem, some times error 0 can be a time out but it wasnt a time out for the server. The request was processed in the server but it took to long so before the success form the server came back the time out happened.

We are trying to fix this by doing some tweaks, still using the same good WASP. For posting, we are increase timeout but no retrys, that way if the post fail after a long time out, it did actually failed, or if it was timeout but the request was ok in the server, then in the next GET you should have the correct object (or at least dont post it twice in the server). For GETs we are increasing the timeout and using a retry policy of 3, and a multiplier by 2. This way if the response is too long for getting it the first time the second time will wait double and the third time even more, if the server didnt response on the third retry then there is a problem and something else must be improved.

Wasp is a great library, I just hope to help by sharing what we are going through now.

Hi @cutiko
I'll try to spend some more time on wasp, on the other hand I would be more happy with pull requests as well. That would make the things faster.

Hello @orhanobut

Thanks, we really like this library.

I have to shamefully admit Im noob, sorry Im not good enough for fixing something as complex as this :( But Im trying to contribute as much as I can with what have come out in our process.

Hi @cutiko ,

I love wasp too ;) How did you implement separate timeouts for posts and gets?

Regards

Hello @ergunkocak

Create 2 different interceptors would be the straight forward path
https://github.com/orhanobut/wasp/wiki/Request-interceptor

If you create a method that return an Interceptor then you can just call it. Maybe using a singleton if the app post/get in a lot of places.

By example if you define your interface as "WaspInterface"

Then the method should be:

public WaspInterface () {
//create the interceptor
return myWaspInterface }