mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 03:38:07 +01:00
Treat transaction conflicts during transactional account updates as contested optimistic locks
This commit is contained in:
committed by
Jon Chambers
parent
417d99a17e
commit
cca747a1f6
@@ -887,7 +887,14 @@ public class Accounts extends AbstractDynamoDbStore {
|
||||
final Throwable unwrapped = ExceptionUtils.unwrap(throwable);
|
||||
|
||||
if (unwrapped instanceof TransactionCanceledException transactionCanceledException) {
|
||||
if ("ConditionalCheckFailed".equals(transactionCanceledException.cancellationReasons().get(0).code())) {
|
||||
if (CONDITIONAL_CHECK_FAILED.equals(transactionCanceledException.cancellationReasons().get(0).code())) {
|
||||
throw new ContestedOptimisticLockException();
|
||||
}
|
||||
|
||||
if (transactionCanceledException.cancellationReasons()
|
||||
.stream()
|
||||
.anyMatch(reason -> TRANSACTION_CONFLICT.equals(reason.code()))) {
|
||||
|
||||
throw new ContestedOptimisticLockException();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user