mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 18:48:06 +01:00
Clear account records from the account cache after username operations
This commit is contained in:
committed by
Jon Chambers
parent
1bebceb29c
commit
4aa4246695
@@ -571,6 +571,12 @@ public class AccountsManager {
|
||||
() -> accounts.getByAccountIdentifierAsync(account.getUuid()).thenApply(Optional::orElseThrow),
|
||||
AccountChangeValidator.USERNAME_CHANGE_VALIDATOR,
|
||||
MAX_UPDATE_ATTEMPTS))
|
||||
.whenComplete((updatedAccount, throwable) -> {
|
||||
if (throwable == null) {
|
||||
// Make a best effort to clear any stale data that may have been cached while this operation was in progress
|
||||
redisDeleteAsync(updatedAccount);
|
||||
}
|
||||
})
|
||||
.thenApply(updatedAccount -> new UsernameReservation(updatedAccount, reservedUsernameHash.get()));
|
||||
}
|
||||
|
||||
@@ -623,7 +629,13 @@ public class AccountsManager {
|
||||
() -> accounts.getByAccountIdentifierAsync(account.getUuid()).thenApply(Optional::orElseThrow),
|
||||
AccountChangeValidator.USERNAME_CHANGE_VALIDATOR,
|
||||
MAX_UPDATE_ATTEMPTS
|
||||
));
|
||||
))
|
||||
.whenComplete((updatedAccount, throwable) -> {
|
||||
if (throwable == null) {
|
||||
// Make a best effort to clear any stale data that may have been cached while this operation was in progress
|
||||
redisDeleteAsync(updatedAccount);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public CompletableFuture<Account> clearUsernameHash(final Account account) {
|
||||
@@ -634,7 +646,13 @@ public class AccountsManager {
|
||||
accounts::clearUsernameHash,
|
||||
() -> accounts.getByAccountIdentifierAsync(account.getUuid()).thenApply(Optional::orElseThrow),
|
||||
AccountChangeValidator.USERNAME_CHANGE_VALIDATOR,
|
||||
MAX_UPDATE_ATTEMPTS));
|
||||
MAX_UPDATE_ATTEMPTS))
|
||||
.whenComplete((updatedAccount, throwable) -> {
|
||||
if (throwable == null) {
|
||||
// Make a best effort to clear any stale data that may have been cached while this operation was in progress
|
||||
redisDeleteAsync(updatedAccount);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Account update(Account account, Consumer<Account> updater) {
|
||||
|
||||
Reference in New Issue
Block a user