comparison OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp @ 5009:ed4ceb31bcf8

Housekeeper plugin: Fix resume of previous processing
author Alain Mazy <am@osimis.io>
date Tue, 24 May 2022 14:47:51 +0200
parents 8feb00fea93d
children 67d98fccc850
comparison
equal deleted inserted replaced
5008:59491402f8f1 5009:ed4ceb31bcf8
535 535
536 GetCurrentDbConfiguration(currentDbConfiguration); 536 GetCurrentDbConfiguration(currentDbConfiguration);
537 537
538 bool needsReconstruct = false; 538 bool needsReconstruct = false;
539 bool needsReingest = false; 539 bool needsReingest = false;
540 bool needsFullProcessing = false;
541 bool needsProcessing = false;
540 542
541 { 543 {
542 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); 544 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_);
545
546 // compare with last full processed configuration
543 CheckNeedsProcessing(needsReconstruct, needsReingest, currentDbConfiguration, pluginStatus_.lastProcessedConfiguration); 547 CheckNeedsProcessing(needsReconstruct, needsReingest, currentDbConfiguration, pluginStatus_.lastProcessedConfiguration);
544 } 548 needsFullProcessing = needsReconstruct || needsReingest;
545 549 needsProcessing = needsFullProcessing;
546 bool needsProcessing = needsReconstruct || needsReingest; 550
551 // if a processing was in progress, check if the config has changed since
552 if (pluginStatus_.currentlyProcessingConfiguration.IsDefined())
553 {
554 needsProcessing = true; // since a processing was in progress, we need at least a partial processing
555
556 bool needsReconstruct2 = false;
557 bool needsReingest2 = false;
558
559 CheckNeedsProcessing(needsReconstruct2, needsReingest2, currentDbConfiguration, pluginStatus_.currentlyProcessingConfiguration);
560 needsFullProcessing = needsReconstruct2 || needsReingest2; // if the configuration has changed compared to the config being processed, we need a full processing again
561 }
562 }
547 563
548 if (!needsProcessing) 564 if (!needsProcessing)
549 { 565 {
550 OrthancPlugins::LogWarning("Housekeeper: everything has been processed already !"); 566 OrthancPlugins::LogWarning("Housekeeper: everything has been processed already !");
551 return; 567 return;
552 } 568 }
553 569
554 if (force_ || needsProcessing) 570 if (force_ || needsFullProcessing)
555 { 571 {
556 if (force_) 572 if (force_)
557 { 573 {
558 OrthancPlugins::LogWarning("Housekeeper: forcing execution -> will perform housekeeping"); 574 OrthancPlugins::LogWarning("Housekeeper: forcing execution -> will perform housekeeping");
559 } 575 }