Coalesce gossip pull requests and serve them in batches (#5501)

* Coalesce gossip pull requests and serve them in batches

* batch all filters and immediately respond to messages in gossip

* Fix tests

* make download_from_replicator perform a greedy recv
This commit is contained in:
Sagar Dhawan
2019-08-15 17:04:45 -07:00
committed by GitHub
parent d5fb493aa4
commit 4ee212ae4c
5 changed files with 187 additions and 163 deletions

View File

@@ -399,17 +399,23 @@ fn network_run_pull(
.map(|f| f.filter.bits.len() as usize / 8)
.sum::<usize>();
bytes += serialized_size(&caller_info).unwrap() as usize;
let filters = filters
.into_iter()
.map(|f| (caller_info.clone(), f))
.collect();
let rsp = network
.get(&to)
.map(|node| {
let mut rsp = vec![];
for filter in filters {
rsp.append(&mut node.lock().unwrap().process_pull_request(
caller_info.clone(),
filter,
now,
));
}
rsp.append(
&mut node
.lock()
.unwrap()
.process_pull_requests(filters, now)
.into_iter()
.flatten()
.collect(),
);
rsp
})
.unwrap();