I use RoboSpice with OkHttpClient module (OkHttpSpiceService) for quite long time requests. For that purposes I need to increase timeouts of http client so I made and set them on 120 seconds.
@Override
protected OkHttpClient createOkHttpClient() {
OkHttpClient okHttpClient = super.createOkHttpClient();
okHttpClient.setConnectTimeout(120, TimeUnit.SECONDS);
okHttpClient.setReadTimeout(120, TimeUnit.SECONDS);
okHttpClient.setWriteTimeout(120, TimeUnit.SECONDS);
return okHttpClient;
}
I do not use caching option so I call SpiceRequest by:
getSpiceManager().execute(spiceRequest, this);
and overide `loadDataFromNetwork()` in this way:
public Feed loadDataFromNetwork() throws Exception {
OkHttpClient okHttpClient = getOkHttpClient();
OkUrlFactory okUrlFactory = new OkUrlFactory(okHttpClient);
HttpURLConnection connection = okUrlFactory.open(uri.toURL());
InputStream inStreamFeed = null;
inStreamFeed = connection.getInputStream();
...
return feed;
}
Everithing works but SpiceService invoking `loadDataFromNetwork()` every 30 seconds (3 times) when response is not comming or is not reachable in this short time.
Is any posibilites to increase or change of time of invoking `loadDataFromNetwork()`? I know that I get response after one minute but using this methods I cannot reach proper response. Maybe I make something wrong?