comparison OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp @ 4612:4982733a4e39 db-changes

fix database retries
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 07 Apr 2021 10:41:39 +0200
parents 37de0a5ebe86
children 2684544ff03c
comparison
equal deleted inserted replaced
4611:dfb7429f0d48 4612:4982733a4e39
548 { 548 {
549 transaction_->Rollback(); 549 transaction_->Rollback();
550 } 550 }
551 catch (OrthancException& e) 551 catch (OrthancException& e)
552 { 552 {
553 LOG(ERROR) << "Cannot rollback transaction: " << e.What(); 553 LOG(INFO) << "Cannot rollback transaction: " << e.What();
554 } 554 }
555 } 555 }
556 } 556 }
557 557
558 IDatabaseWrapper::ITransaction& GetDatabaseTransaction() 558 IDatabaseWrapper::ITransaction& GetDatabaseTransaction()
636 } 636 }
637 catch (OrthancException& e) 637 catch (OrthancException& e)
638 { 638 {
639 if (e.GetErrorCode() == ErrorCode_DatabaseCannotSerialize) 639 if (e.GetErrorCode() == ErrorCode_DatabaseCannotSerialize)
640 { 640 {
641 if (count == maxRetries_) 641 if (count >= maxRetries_)
642 { 642 {
643 throw; 643 throw;
644 } 644 }
645 else 645 else
646 { 646 {
3088 3088
3089 storeStatus_ = StoreStatus_Success; 3089 storeStatus_ = StoreStatus_Success;
3090 } 3090 }
3091 catch (OrthancException& e) 3091 catch (OrthancException& e)
3092 { 3092 {
3093 LOG(ERROR) << "EXCEPTION [" << e.What() << "]"; 3093 if (e.GetErrorCode() == ErrorCode_DatabaseCannotSerialize)
3094 storeStatus_ = StoreStatus_Failure; 3094 {
3095 throw;
3096 }
3097 else
3098 {
3099 LOG(ERROR) << "EXCEPTION [" << e.What() << "]";
3100 storeStatus_ = StoreStatus_Failure;
3101 }
3095 } 3102 }
3096 } 3103 }
3097 }; 3104 };
3098 3105
3099 3106