don't try to build secondary indexes if we don't need them (#17246)

This commit is contained in:
Jeff Washington (jwash) 2021-05-17 17:21:15 -05:00 committed by GitHub
parent 8a574baae2
commit d461aba6a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 8 deletions

View File

@ -5054,14 +5054,16 @@ impl AccountsDb {
}
}
drop(lock);
for (pubkey, account_infos) in accounts_map.into_iter() {
for (_, (_store_id, stored_account)) in account_infos.iter() {
self.accounts_index.update_secondary_indexes(
&pubkey,
&stored_account.account_meta.owner,
&stored_account.data,
&self.account_indexes,
);
if !self.account_indexes.is_empty() {
for (pubkey, account_infos) in accounts_map.into_iter() {
for (_, (_store_id, stored_account)) in account_infos.iter() {
self.accounts_index.update_secondary_indexes(
&pubkey,
&stored_account.account_meta.owner,
&stored_account.data,
&self.account_indexes,
);
}
}
}
}