mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-02 15:16:53 +00:00
Treat transaction conflicts during transactional account updates as contested optimistic locks
This commit is contained in:
1 parent
417d99a17e
commit
cca747a1f6
2 files changed
+35
-1
No files matched your search
@@ -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