refactor process_document_addition_batch

This commit is contained in:
ad hoc 2022-06-02 15:11:50 +02:00
parent 64e3096790
commit 8fc3b7d3b0
No known key found for this signature in database
GPG key ID: 4F00A782990CC643
2 changed files with 7 additions and 10 deletions

View file

@ -170,7 +170,7 @@ mod real {
}
}
pub async fn process_document_addition_batch(&self, mut tasks: Vec<Task>) -> Vec<Task> {
pub async fn process_document_addition_batch(&self, tasks: &mut [Task]) {
fn get_content_uuid(task: &Task) -> Uuid {
match task {
Task {
@ -218,7 +218,8 @@ mod real {
timestamp: now,
});
}
return tasks;
return;
}
};
@ -253,8 +254,6 @@ mod real {
for task in tasks.iter_mut() {
task.events.push(event.clone());
}
tasks
}
_ => panic!("invalid batch!"),
}
@ -355,7 +354,7 @@ mod real {
}
pub async fn process_task(&self, task: &mut Task) {
match self.process_task_inner(&task).await {
match self.process_task_inner(task).await {
Ok(res) => task.events.push(TaskEvent::succeeded(res)),
Err(e) => task.events.push(TaskEvent::failed(e)),
}
@ -509,7 +508,7 @@ mod test {
Self::Mock(mocker)
}
pub async fn process_document_addition_batch(&self, tasks: Vec<Task>) -> Vec<Task> {
pub async fn process_document_addition_batch(&self, tasks: &mut [Task]) {
match self {
IndexResolver::Real(r) => r.process_document_addition_batch(tasks).await,
IndexResolver::Mock(m) => unsafe {