Skip to content

Commit

Permalink
Invalidate cache entries for accounts after successfully adding devices
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-signal committed Dec 7, 2023
1 parent a843780 commit 1fb8827
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ private CompletableFuture<Pair<Account, Device>> addDevice(final UUID accountIde
.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);
Expand Down

0 comments on commit 1fb8827

Please sign in to comment.