From 7dd5719bff571ae7ad5d23816003477545c3b5ae Mon Sep 17 00:00:00 2001 From: LSmyrnaios Date: Tue, 17 Jan 2023 18:25:49 +0200 Subject: [PATCH] - Update a method-call, to reflect the latest changes in the "PublicationsRetriever"-software. - Add TODOs. --- .../openaire/urls_worker/components/ScheduledTasks.java | 1 + .../eu/openaire/urls_worker/util/AssignmentsHandler.java | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/openaire/urls_worker/components/ScheduledTasks.java b/src/main/java/eu/openaire/urls_worker/components/ScheduledTasks.java index eea5881..e001023 100644 --- a/src/main/java/eu/openaire/urls_worker/components/ScheduledTasks.java +++ b/src/main/java/eu/openaire/urls_worker/components/ScheduledTasks.java @@ -19,6 +19,7 @@ public class ScheduledTasks { public void handleNewAssignments() { if ( AssignmentsHandler.hadConnectionErrorOnRequest ) { if ( GeneralController.shouldShutdownWorker ) // Make sure the worker shuts-down, in case the user sends the relevant request, while the worker is stuck in a data-request error-loop. + // TODO - Should this worker inform the Controller that will shutdown? UrlsWorkerApplication.gentleAppShutdown(); try { Thread.sleep(900_000); // Sleep for 15 mins to stall the scheduler from retrying right away, thus giving time to the Controller to recover. diff --git a/src/main/java/eu/openaire/urls_worker/util/AssignmentsHandler.java b/src/main/java/eu/openaire/urls_worker/util/AssignmentsHandler.java index 8c72a5c..b57cc63 100644 --- a/src/main/java/eu/openaire/urls_worker/util/AssignmentsHandler.java +++ b/src/main/java/eu/openaire/urls_worker/util/AssignmentsHandler.java @@ -156,10 +156,9 @@ public class AssignmentsHandler { } if ( idUrlPairsHandled >= ((timesClearingDomainAndPathTrackingData +1) * idUrlsToHandleBeforeClearingDomainAndPathTrackingData) ) { - GenericUtils.clearDomainAndPathTrackingData(); + GenericUtils.clearTrackingData(); // This includes the "blocking data", we may say "if this condition is true, do not bother checking the just-blocking condition". timesClearingDomainAndPathTrackingData ++; timesClearingDomainAndPathBlockingData ++; // Increment this also, as we avoid the following check in this case, but the counter has to be increased nevertheless. - // This includes the "blocking data", we may say "if this condition is true, do not bother checking the just-blocking condition" } else if ( idUrlPairsHandled >= ((timesClearingDomainAndPathBlockingData +1) * idUrlsToHandleBeforeClearingDomainAndPathBlockingData) ) { GenericUtils.clearDomainAndPathBlockingData(); timesClearingDomainAndPathBlockingData ++; @@ -171,8 +170,9 @@ public class AssignmentsHandler { logger.info("The worker will now shutdown, as " + (GeneralController.shouldShutdownWorker ? "it received a \"shutdownWorker\" request!" : "the maximum assignments-batches (" + UrlsWorkerApplication.maxAssignmentsBatchesToHandleBeforeShutdown + ") to be handled was reached!")); - UrlsWorkerApplication.gentleAppShutdown(); - // The "gentleAppShutdown()" will exit the app, so the "isAvailableForWork" will not be set below. + + // TODO - Should this worker inform the Controller that will shutdown? + UrlsWorkerApplication.gentleAppShutdown(); // This will exit the app. } // Note: Cannot call this method, here, retrospectively, as if it runs 100s of times, the memory-stack may break..