Invalidate cache entries for accounts after successfully adding devices

This commit is contained in:
Jon Chambers authored and Jon Chambers committed 2023-12-07 13:27:26 -05:00
1 parent a843780f68
commit 1fb88271e5
1 file changed
+2
@@ -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);