Mercurial > hg > orthanc
comparison OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp @ 5464:38f1d06875ad pg-transactions
delete attachment in case of same instance being uploaded multiple times at the same time
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 12 Dec 2023 17:20:10 +0100 |
parents | 06eb8bc9f024 |
children | dceed5e3d6a9 |
comparison
equal
deleted
inserted
replaced
5459:46ed738c3e5d | 5464:38f1d06875ad |
---|---|
3155 { | 3155 { |
3156 // Note that, sometime, it does not create a new instance, | 3156 // Note that, sometime, it does not create a new instance, |
3157 // in very rare occasions in READ COMMITTED mode when multiple clients are pushing the same instance at the same time, | 3157 // in very rare occasions in READ COMMITTED mode when multiple clients are pushing the same instance at the same time, |
3158 // this thread will not create the instance because another thread has created it in the meantime. | 3158 // this thread will not create the instance because another thread has created it in the meantime. |
3159 // At the end, there is always a thread that creates the instance and this is what we expect. | 3159 // At the end, there is always a thread that creates the instance and this is what we expect. |
3160 throw OrthancException(ErrorCode_InternalError, HttpStatus_409_Conflict, "No new instance while overwriting; this might happen if another client has pushed the same instance at the same time."); | 3160 |
3161 // Note, we must delete the attachments that have already been stored from this failed insertion (they have not yet been added into the DB) | |
3162 throw OrthancException(ErrorCode_DuplicateResource, "No new instance while overwriting; this might happen if another client has pushed the same instance at the same time."); | |
3161 } | 3163 } |
3162 } | 3164 } |
3163 else | 3165 else |
3164 { | 3166 { |
3165 // Do nothing if the instance already exists and overwriting is disabled | 3167 // Do nothing if the instance already exists and overwriting is disabled |