diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java b/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java index 0f90809b4..591791cbc 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java @@ -292,6 +292,8 @@ private CompletableFuture> 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);