Do not send shutDownRequests to workers which have already shutdown.

This commit is contained in:
Lampros Smyrnaios 2023-05-29 12:42:54 +03:00
parent a38d6ace79
commit f9c6bad768
1 changed files with 4 additions and 2 deletions

View File

@ -41,8 +41,10 @@ public class ShutdownController {
else { else {
shouldShutdownService = true; shouldShutdownService = true;
// Send "shutdownWorker" requests to all Workers. // Send "shutdownWorker" requests to all Workers.
for ( String workerId : UrlsController.workersInfoMap.keySet() ) for ( String workerId : UrlsController.workersInfoMap.keySet() ) {
if ( ! UrlsController.workersInfoMap.get(workerId).getHasShutdown() )
shutdownService.postShutdownOrCancelRequestToWorker(workerId, UrlsController.workersInfoMap.get(workerId).getWorkerIP(), false); shutdownService.postShutdownOrCancelRequestToWorker(workerId, UrlsController.workersInfoMap.get(workerId).getWorkerIP(), false);
}
// That's it for now. The workers may take some hours to finish their work (including delivering the full-text files). // That's it for now. The workers may take some hours to finish their work (including delivering the full-text files).
// A scheduler monitors the shutdown of the workers. Once all worker have shutdown, the Controller shuts down as well. // A scheduler monitors the shutdown of the workers. Once all worker have shutdown, the Controller shuts down as well.