Mercurial > hg > orthanc
comparison OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp @ 5134:6aa41d86b948
fix ModificationJob state machine
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 10 Jan 2023 11:46:00 +0100 |
parents | f2dcdbe05884 |
children | e71b22a43c0b |
comparison
equal
deleted
inserted
replaced
5133:7dacd2c3c009 | 5134:6aa41d86b948 |
---|---|
174 } | 174 } |
175 | 175 |
176 | 176 |
177 LOG(INFO) << "Modifying instance in a job: " << instance; | 177 LOG(INFO) << "Modifying instance in a job: " << instance; |
178 | 178 |
179 | |
180 /** | 179 /** |
181 * Retrieve the original instance from the DICOM cache. | 180 * Retrieve the original instance from the DICOM cache. |
182 **/ | 181 **/ |
183 | 182 |
184 std::unique_ptr<DicomInstanceHasher> originalHasher; | 183 std::unique_ptr<DicomInstanceHasher> originalHasher; |
278 * Store the resulting DICOM instance into the Orthanc store. | 277 * Store the resulting DICOM instance into the Orthanc store. |
279 **/ | 278 **/ |
280 | 279 |
281 std::string modifiedInstance; | 280 std::string modifiedInstance; |
282 ServerContext::StoreResult result = GetContext().Store(modifiedInstance, *toStore, StoreInstanceMode_Default); | 281 ServerContext::StoreResult result = GetContext().Store(modifiedInstance, *toStore, StoreInstanceMode_Default); |
283 if (result.GetStatus() != StoreStatus_Success) | 282 if (result.GetStatus() != StoreStatus_Success && result.GetStatus() != StoreStatus_AlreadyStored) // when retrying a job, we might save the same data again |
284 { | 283 { |
285 throw OrthancException(ErrorCode_CannotStoreInstance, | 284 throw OrthancException(ErrorCode_CannotStoreInstance, |
286 "Error while storing a modified instance " + instance); | 285 "Error while storing a modified instance " + instance); |
287 } | 286 } |
288 | 287 |