- Increase the "ReadTimeout" to 2 hours, as the Worker struggles to get the assignments-data in time.
- Revert the change about special handling of the "RestClientException". The exMsg was appearing in a different line, in the logs, and was a "SocketTimeoutException".
This commit is contained in:
parent
bfa76e9484
commit
69ea5b6d19
|
@ -55,7 +55,7 @@ public class AssignmentsHandler {
|
|||
private static final boolean askForTest = false; // Enable this only for testing.
|
||||
private static String requestUrl;
|
||||
|
||||
public static final RestTemplate restTemplate = new RestTemplateBuilder().setConnectTimeout(Duration.ofMinutes(2)).setReadTimeout(Duration.ofHours(1)).build();
|
||||
public static final RestTemplate restTemplate = new RestTemplateBuilder().setConnectTimeout(Duration.ofMinutes(2)).setReadTimeout(Duration.ofHours(2)).build();
|
||||
|
||||
public static boolean hadConnectionErrorOnRequest = false;
|
||||
|
||||
|
@ -108,18 +108,8 @@ public class AssignmentsHandler {
|
|||
try { // Here, the HTTP-request is executed.
|
||||
assignmentRequest = restTemplate.getForObject(requestUrl, AssignmentsRequest.class);
|
||||
} catch (RestClientException rce) {
|
||||
final String errorMsg = "Could not retrieve the assignments! ";
|
||||
String exceptionMsg = rce.getMessage(); // It also shows the response body of the response (from Spring v.2.5.6 onwards).
|
||||
if ( (exceptionMsg != null) && !exceptionMsg.isEmpty() ) {
|
||||
hadConnectionErrorOnRequest = true;
|
||||
logger.error(errorMsg + exceptionMsg);
|
||||
}
|
||||
else { // Otherwise, it's an undefined error, which occurs randomly
|
||||
// and does not mean that the Controller has some problem, or the Worker requested something in a wrong way,
|
||||
// or that the firewall disallow the connection (in this case we get "connection refused/timed out").
|
||||
logger.error(errorMsg, rce);
|
||||
// Try again immediately, do not wait 15 mins. The Controller will take some minutes to prepare the data, before it sends them anyway.
|
||||
}
|
||||
logger.error("Could not retrieve the assignments! " + rce.getMessage()); // The exMsg also shows the response body of the response (from Spring v.2.5.6 onwards).
|
||||
hadConnectionErrorOnRequest = true;
|
||||
return null;
|
||||
} catch (IllegalArgumentException iae) {
|
||||
logger.error("Could not retrieve the assignments, as the provided Controller's url was malformed! " + iae.getMessage());
|
||||
|
|
Loading…
Reference in New Issue