Mercurial > hg > orthanc
diff OrthancServer/ServerIndex.cpp @ 513:935e8c7e0b18
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 16 Aug 2013 17:11:45 +0200 |
parents | 3b735fdf320b |
children | 2c739f76d0bb |
line wrap: on
line diff
--- a/OrthancServer/ServerIndex.cpp Fri Aug 16 15:39:53 2013 +0200 +++ b/OrthancServer/ServerIndex.cpp Fri Aug 16 17:11:45 2013 +0200 @@ -1416,6 +1416,7 @@ boost::this_thread::sleep(boost::posix_time::seconds(1)); boost::mutex::scoped_lock lock(that->mutex_); + while (!that->unstableResources_.IsEmpty() && that->unstableResources_.GetOldestPayload().GetAge() > static_cast<unsigned int>(stableAge)) { @@ -1425,25 +1426,29 @@ UnstableResourcePayload payload; int64_t id = that->unstableResources_.RemoveOldest(payload); - switch (payload.type_) + // Ensure that the resource is still existing before logging the change + if (that->db_->IsExistingResource(id)) { - case Orthanc::ResourceType_Patient: - that->db_->LogChange(ChangeType_StablePatient, id, ResourceType_Patient); - break; - - case Orthanc::ResourceType_Study: - that->db_->LogChange(ChangeType_StableStudy, id, ResourceType_Study); - break; + switch (payload.type_) + { + case Orthanc::ResourceType_Patient: + that->db_->LogChange(ChangeType_StablePatient, id, ResourceType_Patient); + break; - case Orthanc::ResourceType_Series: - that->db_->LogChange(ChangeType_StableSeries, id, ResourceType_Series); - break; + case Orthanc::ResourceType_Study: + that->db_->LogChange(ChangeType_StableStudy, id, ResourceType_Study); + break; - default: - throw OrthancException(ErrorCode_InternalError); + case Orthanc::ResourceType_Series: + that->db_->LogChange(ChangeType_StableSeries, id, ResourceType_Series); + break; + + default: + throw OrthancException(ErrorCode_InternalError); + } + + //LOG(INFO) << "Stable resource: " << EnumerationToString(payload.type_) << " " << id; } - - //LOG(INFO) << "Stable resource: " << EnumerationToString(payload.type_) << " " << id; } }