processes pull-request callers only once per unique caller (#13750)

process_pull_requests acquires a write lock on crds table to update
records timestamp for each of the pull-request callers:
https://github.com/solana-labs/solana/blob/3087c9049/core/src/crds_gossip_pull.rs#L287-L300
However, pull-requests overlap a lot in callers and this function ends
up doing a lot of redundant duplicate work.

This commit obtains unique callers before acquiring an exclusive lock on
crds table.
This commit is contained in:
behzad nouri
2020-11-22 17:51:14 +00:00
committed by GitHub
parent a13083aa65
commit 26bf2b7e45
3 changed files with 81 additions and 17 deletions

View File

@@ -240,8 +240,8 @@ impl Crds {
/// Update the timestamp's of all the labels that are associated with Pubkey
pub fn update_record_timestamp(&mut self, pubkey: &Pubkey, now: u64) {
for label in &CrdsValue::record_labels(pubkey) {
self.update_label_timestamp(label, now);
for label in CrdsValue::record_labels(*pubkey) {
self.update_label_timestamp(&label, now);
}
}