# HG changeset patch # User Alain Mazy # Date 1741628240 -3600 # Node ID 199adc0bdb7f8f81c51db718e7ebba8993a86add # Parent 0fb9706524bbb855b93e04b4b7bc28927fd7ec23 When encountering an error, the housekeeper now skips the resource and continues processing. diff -r 0fb9706524bb -r 199adc0bdb7f NEWS --- a/NEWS Fri Feb 28 09:43:16 2025 +0100 +++ b/NEWS Mon Mar 10 18:37:20 2025 +0100 @@ -25,6 +25,9 @@ * Recovered compatibility with Windows XP that was broken because of DCMTK 3.6.9 * Enabled support of the 1.2.840.10008.1.2.1.99 transfer syntax (Deflated Explicit VR Little Endian) in static builds +* Housekeeper plugin: + - When encountering an error, the housekeeper now skips the resource and continues processing. + Version 1.12.6 (2025-01-22) diff -r 0fb9706524bb -r 199adc0bdb7f OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp --- a/OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp Fri Feb 28 09:43:16 2025 +0100 +++ b/OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp Mon Mar 10 18:37:20 2025 +0100 @@ -549,39 +549,46 @@ const Json::Value& change = changes["Changes"][i]; int64_t seq = change["Seq"].asInt64(); - if (!limitToChange_.empty()) // if updating only maindicomtags for a single level + try { - if (change["ChangeType"] == limitToChange_) + if (!limitToChange_.empty()) // if updating only maindicomtags for a single level + { + if (change["ChangeType"] == limitToChange_) + { + Json::Value result; + Json::Value request; + request["ReconstructFiles"] = false; + request["LimitToThisLevelMainDicomTags"] = true; + OrthancPlugins::RestApiPost(result, "/" + limitToUrl_ + "/" + change["ID"].asString() + "/reconstruct", request, false); + } + } + else { - Json::Value result; - Json::Value request; - request["ReconstructFiles"] = false; - request["LimitToThisLevelMainDicomTags"] = true; - OrthancPlugins::RestApiPost(result, "/" + limitToUrl_ + "/" + change["ID"].asString() + "/reconstruct", request, false); + if (change["ChangeType"] == "NewStudy") // some StableStudy might be missing if orthanc was shutdown during a StableAge -> consider only the NewStudy events that can not be missed + { + Json::Value result; + + if (needsReconstruct || needsReingest ||force_) + { + Json::Value request; + if (needsReingest) + { + request["ReconstructFiles"] = true; + } + OrthancPlugins::RestApiPost(result, "/studies/" + change["ID"].asString() + "/reconstruct", request, false); + } + + if (needsDicomWebCaching) + { + Json::Value request; + OrthancPlugins::RestApiPost(result, "/studies/" + change["ID"].asString() + "/update-dicomweb-cache", request, true); + } + } } } - else + catch (...) { - if (change["ChangeType"] == "NewStudy") // some StableStudy might be missing if orthanc was shutdown during a StableAge -> consider only the NewStudy events that can not be missed - { - Json::Value result; - - if (needsReconstruct || needsReingest ||force_) - { - Json::Value request; - if (needsReingest) - { - request["ReconstructFiles"] = true; - } - OrthancPlugins::RestApiPost(result, "/studies/" + change["ID"].asString() + "/reconstruct", request, false); - } - - if (needsDicomWebCaching) - { - Json::Value request; - OrthancPlugins::RestApiPost(result, "/studies/" + change["ID"].asString() + "/update-dicomweb-cache", request, true); - } - } + ORTHANC_PLUGINS_LOG_ERROR("Housekeeper: unhandled error while processing change " + boost::lexical_cast(seq) + ", skipping resource."); } { @@ -703,9 +710,17 @@ { if (runningPeriods_.isInPeriod()) { - completed = ProcessChanges(needsReconstruct, needsReingest, needsDicomWebCaching, currentDbConfiguration); - SaveStatusInDb(); - + try + { + completed = ProcessChanges(needsReconstruct, needsReingest, needsDicomWebCaching, currentDbConfiguration); + SaveStatusInDb(); + } + catch (...) + { + ORTHANC_PLUGINS_LOG_ERROR("Housekeeper: unhandled error while processing change " + boost::lexical_cast(pluginStatus_.lastProcessedChange) + + " / " + boost::lexical_cast(pluginStatus_.lastChangeToProcess)); + } + if (!completed) { boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_);