Code cleanup.

This commit is contained in:
Lampros Smyrnaios 2022-02-19 17:21:51 +02:00
parent b63ad87d00
commit 0d2f0b8b01
1 changed files with 3 additions and 3 deletions

View File

@ -56,9 +56,6 @@ public class AssignmentsHandler {
public static AssignmentsRequest requestAssignments()
{
// Go request the assignments, the worker is busy. This may take more time than the scheduled time to request new assignments.
isAvailableForWork = false;
String requestUrl = UrlsWorkerApplication.controllerBaseUrl + (askForTest ? "test/" : "") + "urls?workerId=" + UrlsWorkerApplication.workerId + "&workerAssignmentsLimit=" + UrlsWorkerApplication.maxAssignmentsLimitPerBatch;
logger.info("Going to request assignments from the controller-server: " + requestUrl);
@ -77,6 +74,9 @@ public class AssignmentsHandler {
public static void handleAssignments()
{
// Go request the assignments, the worker is busy. This may take more time than the scheduled time to request new assignments.
isAvailableForWork = false;
AssignmentsRequest assignmentsRequest = requestAssignments();
if ( assignmentsRequest == null ) {
isAvailableForWork = true; // Make sure it is "true" both in case of a "RestClientException" and in case of a "null" object.