Mercurial > hg > orthanc
diff OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp @ 5456:06eb8bc9f024 pg-transactions
raise 409 if multiple clients are writing the same instance at the same time
author | Alain Mazy <am@osimis.io> |
---|---|
date | Fri, 08 Dec 2023 09:18:44 +0100 |
parents | 176bc05f85f4 |
children | 38f1d06875ad |
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Thu Dec 07 12:04:11 2023 +0100 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Fri Dec 08 09:18:44 2023 +0100 @@ -3153,7 +3153,11 @@ if (!transaction.CreateInstance(status, instanceId, hashPatient_, hashStudy_, hashSeries_, hashInstance_)) { - throw OrthancException(ErrorCode_InternalError, "No new instance while overwriting; this should not happen."); + // Note that, sometime, it does not create a new instance, + // in very rare occasions in READ COMMITTED mode when multiple clients are pushing the same instance at the same time, + // this thread will not create the instance because another thread has created it in the meantime. + // At the end, there is always a thread that creates the instance and this is what we expect. + 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."); } } else