Merge pull request #48 from overleaf/sk-extend-request-timeouts

Extend http request timeouts
This commit is contained in:
Shane Kilkelly 2018-12-17 10:48:26 +00:00 committed by GitHub
commit 8e25bbf61a

View file

@ -130,6 +130,7 @@ public abstract class Request<T extends Result> {
HttpRequest request = Instance.httpRequestFactory.buildGetRequest(
new GenericUrl(url)
);
setTimeouts(request);
request(request);
} catch (IOException e) {
e.printStackTrace();
@ -147,6 +148,7 @@ public abstract class Request<T extends Result> {
getPostBody().getBytes()
)
);
setTimeouts(request);
request(request);
} catch (IOException e) {
e.printStackTrace();
@ -159,4 +161,10 @@ public abstract class Request<T extends Result> {
future = request.executeAsync();
}
private void setTimeouts(HttpRequest request) {
// timeouts are 20s by default
int threeMinutesInMs = 1000 * 60 * 3;
request.setReadTimeout(threeMinutesInMs);
}
}