changeset 4612:4982733a4e39 db-changes

fix database retries
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 07 Apr 2021 10:41:39 +0200
parents dfb7429f0d48
children 2684544ff03c
files OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Fri Apr 02 13:51:18 2021 +0200
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Wed Apr 07 10:41:39 2021 +0200
@@ -550,7 +550,7 @@
         }
         catch (OrthancException& e)
         {
-          LOG(ERROR) << "Cannot rollback transaction: " << e.What();
+          LOG(INFO) << "Cannot rollback transaction: " << e.What();
         }
       }
     }
@@ -638,7 +638,7 @@
       {
         if (e.GetErrorCode() == ErrorCode_DatabaseCannotSerialize)
         {
-          if (count == maxRetries_)
+          if (count >= maxRetries_)
           {
             throw;
           }
@@ -3090,8 +3090,15 @@
         }
         catch (OrthancException& e)
         {
-          LOG(ERROR) << "EXCEPTION [" << e.What() << "]";
-          storeStatus_ = StoreStatus_Failure;
+          if (e.GetErrorCode() == ErrorCode_DatabaseCannotSerialize)
+          {
+            throw;
+          }
+          else
+          {
+            LOG(ERROR) << "EXCEPTION [" << e.What() << "]";
+            storeStatus_ = StoreStatus_Failure;
+          }
         }
       }
     };