diff --git a/src/main/java/eu/openaire/urls_controller/services/UrlsServiceImpl.java b/src/main/java/eu/openaire/urls_controller/services/UrlsServiceImpl.java index ada378b..8b1c8d0 100644 --- a/src/main/java/eu/openaire/urls_controller/services/UrlsServiceImpl.java +++ b/src/main/java/eu/openaire/urls_controller/services/UrlsServiceImpl.java @@ -375,12 +375,7 @@ public class UrlsServiceImpl implements UrlsService { logger.warn("The current thread was interrupted when waiting for the worker-threads to finish inserting into the tables: " + ie.getMessage()); // This is a very rare case. At the moment, we just move on with table-merging. } catch (RuntimeException re) { - DatabaseConnector.databaseLock.lock(); - String assignmentErrorMsg = deleteAssignmentsBatch(curReportAssignmentsCounter); - DatabaseConnector.databaseLock.unlock(); String errorMsg = re.getMessage(); - if ( assignmentErrorMsg != null ) - errorMsg += "\n" + assignmentErrorMsg; logger.error(errorMsg); postReportResultToWorker(curWorkerId, curReportAssignmentsCounter, errorMsg); return false; @@ -404,6 +399,7 @@ public class UrlsServiceImpl implements UrlsService { } // Delete the assignments each time, as they are bound to the "current" assignmentsCounter. Otherwise, they will never be deleted! + // If this method exits sooner, due tio an error, then the assignments are not deleted in order to wait for the schedulers to retry them and not be given to workers, to avoid reprocessing the urls. DatabaseConnector.databaseLock.lock(); String deleteErrorMsg = deleteAssignmentsBatch(curReportAssignmentsCounter); if ( deleteErrorMsg != null ) {