Mercurial > hg > orthanc
changeset 6034:199adc0bdb7f
When encountering an error, the housekeeper now skips the resource and continues processing.
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Mon, 10 Mar 2025 18:37:20 +0100 |
parents | 0fb9706524bb |
children | cba3e8ca3a87 |
files | NEWS OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp |
diffstat | 2 files changed, 49 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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<std::string>(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<std::string>(pluginStatus_.lastProcessedChange) + + " / " + boost::lexical_cast<std::string>(pluginStatus_.lastChangeToProcess)); + } + if (!completed) { boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_);