diff Framework/Plugins/DatabaseBackendAdapterV4.cpp @ 445:cec6a0cd399f pg-transactions

now logging DatabaseCannotSerialize as a warning only with the details (Orthanc will log it as an error after all retries)
author Alain Mazy <am@osimis.io>
date Wed, 10 Jan 2024 15:25:03 +0100
parents f16faa1fdc46
children 5881e4af5799
line wrap: on
line diff
--- a/Framework/Plugins/DatabaseBackendAdapterV4.cpp	Wed Jan 10 15:22:40 2024 +0100
+++ b/Framework/Plugins/DatabaseBackendAdapterV4.cpp	Wed Jan 10 15:25:03 2024 +0100
@@ -1350,7 +1350,14 @@
     }
     catch (::Orthanc::OrthancException& e)
     {
-      LOG(ERROR) << "Exception in database back-end: " << e.What();
+      if (e.GetErrorCode() == ::Orthanc::ErrorCode_DatabaseCannotSerialize)
+      {
+        LOG(WARNING) << "An SQL transaction failed and will likely be retried: " << e.GetDetails();
+      }
+      else
+      {
+        LOG(ERROR) << "Exception in database back-end: " << e.What();
+      }
       return static_cast<OrthancPluginErrorCode>(e.GetErrorCode());
     }
     catch (::std::runtime_error& e)