mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-17 21:29:51 +00:00
HttpClient: Remove retrying of requests.
This commit is contained in:
parent
0da46fe14d
commit
e1db556f8f
1 changed files with 73 additions and 80 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2015 the original author or authors.
|
* Copyright the original author or authors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -168,9 +168,6 @@ public final class HttpClient {
|
||||||
checkNotNull(callback);
|
checkNotNull(callback);
|
||||||
checkNotNull(url);
|
checkNotNull(url);
|
||||||
|
|
||||||
int tries = 3;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
final Request.Builder request = new Request.Builder();
|
final Request.Builder request = new Request.Builder();
|
||||||
request.url(url);
|
request.url(url);
|
||||||
request.headers(Headers.of(headers));
|
request.headers(Headers.of(headers));
|
||||||
|
@ -247,9 +244,6 @@ public final class HttpClient {
|
||||||
throw new InternalErrorException(url, bodyPeek);
|
throw new InternalErrorException(url, bodyPeek);
|
||||||
} else {
|
} else {
|
||||||
final String message = "got response: " + responseCode + " " + response.message();
|
final String message = "got response: " + responseCode + " " + response.message();
|
||||||
if (tries-- > 0)
|
|
||||||
log.info("{}, retrying...", message);
|
|
||||||
else
|
|
||||||
throw new IOException(message + ": " + url);
|
throw new IOException(message + ": " + url);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -257,7 +251,6 @@ public final class HttpClient {
|
||||||
response.close();
|
response.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static final Pattern P_REDIRECT_HTTP_EQUIV = Pattern.compile(
|
private static final Pattern P_REDIRECT_HTTP_EQUIV = Pattern.compile(
|
||||||
"<META\\s+http-equiv=\"?refresh\"?\\s+content=\"\\d+;\\s*URL=([^\"]+)\"", Pattern.CASE_INSENSITIVE);
|
"<META\\s+http-equiv=\"?refresh\"?\\s+content=\"\\d+;\\s*URL=([^\"]+)\"", Pattern.CASE_INSENSITIVE);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue