fix: limit concurrency level of batch get encode collab (#892)
This commit is contained in:
parent
9942e68089
commit
8ab5da4aef
|
|
@ -37,6 +37,8 @@ pub enum CollaborationCommand {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const BATCH_GET_ENCODE_COLLAB_CONCURRENCY: usize = 10;
|
||||||
|
|
||||||
pub(crate) fn spawn_collaboration_command<S>(
|
pub(crate) fn spawn_collaboration_command<S>(
|
||||||
mut command_recv: CLCommandReceiver,
|
mut command_recv: CLCommandReceiver,
|
||||||
group_sender_by_object_id: &Arc<DashMap<String, GroupCommandSender>>,
|
group_sender_by_object_id: &Arc<DashMap<String, GroupCommandSender>>,
|
||||||
|
|
@ -80,13 +82,13 @@ pub(crate) fn spawn_collaboration_command<S>(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
.buffer_unordered(BATCH_GET_ENCODE_COLLAB_CONCURRENCY)
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let mut outputs: HashMap<String, EncodedCollab> = HashMap::new();
|
let mut outputs: HashMap<String, EncodedCollab> = HashMap::new();
|
||||||
for task in tasks {
|
for (object_id, encoded_collab) in tasks.into_iter().flatten() {
|
||||||
let result = task.await;
|
if let Some(encoded_collab) = encoded_collab {
|
||||||
if let Ok((object_id, Some(encoded_collab))) = result {
|
|
||||||
outputs.insert(object_id, encoded_collab);
|
outputs.insert(object_id, encoded_collab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue