changeset 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 59491402f8f1
children 88d838c6b4c7
files NEWS OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp
diffstat 2 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Tue May 24 14:47:35 2022 +0200
+++ b/NEWS	Tue May 24 14:47:51 2022 +0200
@@ -2,6 +2,11 @@
 ===========================
 
 
+Maintenance
+-----------
+
+* Housekeeper plugin: Fix resume of previous processing
+
 Version 1.11.0 (2022-05-09)
 ===========================
 
--- a/OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp	Tue May 24 14:47:35 2022 +0200
+++ b/OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp	Tue May 24 14:47:51 2022 +0200
@@ -537,21 +537,37 @@
 
   bool needsReconstruct = false;
   bool needsReingest = false;
+  bool needsFullProcessing = false;
+  bool needsProcessing = false;
 
   {
     boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_);
+
+    // compare with last full processed configuration
     CheckNeedsProcessing(needsReconstruct, needsReingest, currentDbConfiguration, pluginStatus_.lastProcessedConfiguration);
+    needsFullProcessing = needsReconstruct || needsReingest;
+    needsProcessing = needsFullProcessing;
+
+      // if a processing was in progress, check if the config has changed since
+    if (pluginStatus_.currentlyProcessingConfiguration.IsDefined())
+    {
+      needsProcessing = true;       // since a processing was in progress, we need at least a partial processing
+
+      bool needsReconstruct2 = false;
+      bool needsReingest2 = false;
+
+      CheckNeedsProcessing(needsReconstruct2, needsReingest2, currentDbConfiguration, pluginStatus_.currentlyProcessingConfiguration);
+      needsFullProcessing = needsReconstruct2 || needsReingest2;  // if the configuration has changed compared to the config being processed, we need a full processing again
+    }
   }
 
-  bool needsProcessing = needsReconstruct || needsReingest;
-
   if (!needsProcessing)
   {
     OrthancPlugins::LogWarning("Housekeeper: everything has been processed already !");
     return;
   }
 
-  if (force_ || needsProcessing)
+  if (force_ || needsFullProcessing)
   {
     if (force_)
     {