Fix: app won't start, if cache is disabled
This commit is contained in:
parent
1cf2d35f74
commit
f926f784b3
|
@ -43,7 +43,6 @@ public abstract class HttpClient {
|
|||
protected CookieJarImpl cookieJar;
|
||||
protected Config config;
|
||||
protected boolean loggedIn = false;
|
||||
protected int loginTries = 0;
|
||||
private final String name;
|
||||
|
||||
protected HttpClient(String name, Config config) {
|
||||
|
@ -105,13 +104,17 @@ public abstract class HttpClient {
|
|||
}
|
||||
|
||||
public Response execute(Request req) throws IOException {
|
||||
log.trace("Cache hit ratio {}/{} = {}", cache.hitCount(), cache.requestCount(), NumberFormat.getPercentInstance().format(cache.hitCount() / (double) cache.requestCount()));
|
||||
if (cache != null) {
|
||||
log.trace("Cache hit ratio {}/{} = {}", cache.hitCount(), cache.requestCount(), NumberFormat.getPercentInstance().format(cache.hitCount() / (double) cache.requestCount()));
|
||||
}
|
||||
Response resp = client.newCall(req).execute();
|
||||
return resp;
|
||||
}
|
||||
|
||||
public Response execute(Request request, int timeoutInMillis) throws IOException {
|
||||
log.trace("Cache hit ratio {}/{} = {}", cache.hitCount(), cache.requestCount(), NumberFormat.getPercentInstance().format(cache.hitCount() / (double) cache.requestCount()));
|
||||
if (cache != null) {
|
||||
log.trace("Cache hit ratio {}/{} = {}", cache.hitCount(), cache.requestCount(), NumberFormat.getPercentInstance().format(cache.hitCount() / (double) cache.requestCount()));
|
||||
}
|
||||
return client.newBuilder() //
|
||||
.connectTimeout(timeoutInMillis, TimeUnit.MILLISECONDS) //
|
||||
.readTimeout(timeoutInMillis, TimeUnit.MILLISECONDS).build() //
|
||||
|
|
Loading…
Reference in New Issue