Let AccountsUpdate take care to evict accounts from the account cache
Accounts need to be evicted from the account cache when they are updated. Instead of leaving this responsibility to the caller let AccountsUpdate take care of this. This is more convenient and ensures that none of the callers forgets about it. Accounts also need to be evicted from the account cache on creation, since the account cache may hold an empty AccountState instance for that account ID (if it was requested from the account cache before and was found missing). After updating accounts they also need to be reindexed, but this is automatically done when accounts are evicted from the account cache. Change-Id: I08d5c756eabd43c29bdc217e7b1c3d85ebf15197 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -41,7 +41,6 @@ import com.google.gerrit.server.account.externalids.ExternalIds;
|
||||
import com.google.gerrit.server.account.externalids.ExternalIdsUpdate;
|
||||
import com.google.gerrit.server.api.accounts.AccountExternalIdCreator;
|
||||
import com.google.gerrit.server.group.GroupsCollection;
|
||||
import com.google.gerrit.server.index.account.AccountIndexer;
|
||||
import com.google.gerrit.server.mail.send.OutgoingEmailValidator;
|
||||
import com.google.gerrit.server.ssh.SshKeyCache;
|
||||
import com.google.gwtorm.server.OrmDuplicateKeyException;
|
||||
@@ -70,7 +69,6 @@ public class CreateAccount implements RestModifyView<TopLevelResource, AccountIn
|
||||
private final SshKeyCache sshKeyCache;
|
||||
private final AccountCache accountCache;
|
||||
private final AccountsUpdate.User accountsUpdate;
|
||||
private final AccountIndexer indexer;
|
||||
private final AccountByEmailCache byEmailCache;
|
||||
private final AccountLoader.Factory infoLoader;
|
||||
private final DynamicSet<AccountExternalIdCreator> externalIdCreators;
|
||||
@@ -89,7 +87,6 @@ public class CreateAccount implements RestModifyView<TopLevelResource, AccountIn
|
||||
SshKeyCache sshKeyCache,
|
||||
AccountCache accountCache,
|
||||
AccountsUpdate.User accountsUpdate,
|
||||
AccountIndexer indexer,
|
||||
AccountByEmailCache byEmailCache,
|
||||
AccountLoader.Factory infoLoader,
|
||||
DynamicSet<AccountExternalIdCreator> externalIdCreators,
|
||||
@@ -105,7 +102,6 @@ public class CreateAccount implements RestModifyView<TopLevelResource, AccountIn
|
||||
this.sshKeyCache = sshKeyCache;
|
||||
this.accountCache = accountCache;
|
||||
this.accountsUpdate = accountsUpdate;
|
||||
this.indexer = indexer;
|
||||
this.byEmailCache = byEmailCache;
|
||||
this.infoLoader = infoLoader;
|
||||
this.externalIdCreators = externalIdCreators;
|
||||
@@ -198,7 +194,6 @@ public class CreateAccount implements RestModifyView<TopLevelResource, AccountIn
|
||||
|
||||
accountCache.evictByUsername(username);
|
||||
byEmailCache.evict(input.email);
|
||||
indexer.index(id);
|
||||
|
||||
AccountLoader loader = infoLoader.create(true);
|
||||
AccountInfo info = loader.get(id);
|
||||
|
||||
Reference in New Issue
Block a user