optimize state compressor I/O w/ batch operation
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
527494a34b
commit
dd8c646b63
3 changed files with 69 additions and 35 deletions
|
@ -1,4 +1,5 @@
|
|||
use std::{
|
||||
borrow::Borrow,
|
||||
collections::{BTreeMap, HashSet},
|
||||
sync::Arc,
|
||||
time::Instant,
|
||||
|
@ -193,15 +194,16 @@ pub(super) async fn upgrade_outlier_to_timeline_pdu(
|
|||
extremities.retain(|id| retained.contains(id));
|
||||
debug!("Retained {} extremities. Compressing state", extremities.len());
|
||||
|
||||
let mut state_ids_compressed = HashSet::new();
|
||||
for (shortstatekey, id) in &state_at_incoming_event {
|
||||
state_ids_compressed.insert(
|
||||
self.services
|
||||
.state_compressor
|
||||
.compress_state_event(*shortstatekey, id)
|
||||
.await,
|
||||
);
|
||||
}
|
||||
let state_ids_compressed: HashSet<_> = self
|
||||
.services
|
||||
.state_compressor
|
||||
.compress_state_events(
|
||||
state_at_incoming_event
|
||||
.iter()
|
||||
.map(|(ssk, eid)| (ssk, eid.borrow())),
|
||||
)
|
||||
.collect()
|
||||
.await;
|
||||
|
||||
let state_ids_compressed = Arc::new(state_ids_compressed);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue