Invalidate cache entries for accounts after successfully adding devices

This commit is contained in:
Jon Chambers 2023-12-07 13:07:17 -05:00 committed by Jon Chambers
parent a843780f68
commit 1fb88271e5
1 changed files with 2 additions and 0 deletions

View File

@ -292,6 +292,8 @@ public class AccountsManager {
.thenCompose(ignored -> accounts.updateTransactionallyAsync(account, additionalWriteItems))
.thenApply(ignored -> new Pair<>(account, account.getDevice(nextDeviceId).orElseThrow()));
})
.thenCompose(updatedAccountAndDevice -> redisDeleteAsync(updatedAccountAndDevice.first())
.thenApply(ignored -> updatedAccountAndDevice))
.exceptionallyCompose(throwable -> {
if (ExceptionUtils.unwrap(throwable) instanceof ContestedOptimisticLockException && retries > 0) {
return addDevice(accountIdentifier, deviceSpec, retries - 1);