Execute the "AssignmentHandler.handleAssignment()", only from the scheduler, as it starts automatically when the program starts.

This commit is contained in:
Lampros Smyrnaios 2021-06-11 13:44:33 +03:00
parent 5f3409e072
commit 3550ed71d9
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
package eu.openaire.urls_worker;
import eu.openaire.urls_worker.util.AssignmentHandler;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@ -12,8 +12,6 @@ public class UrlsWorkerApplication {
public static void main(String[] args) {
SpringApplication.run(UrlsWorkerApplication.class, args);
AssignmentHandler.handleAssignment();
}
}

View File

@ -19,7 +19,7 @@ public class AssignmentHandler {
private static final Logger logger = LoggerFactory.getLogger(AssignmentHandler.class);
public static boolean isAvailableForWork = false;
public static boolean isAvailableForWork = true;
public static Assignment requestAssignment()
{
@ -65,6 +65,8 @@ public class AssignmentHandler {
logger.warn("The assignment was found to be null!");
return;
}
// Start handling the assignment, the worker is busy.
isAvailableForWork = false;
List<Task> tasks = assignment.getTasks();