refactor the Task a little bit

This commit is contained in:
Tamo 2022-10-12 03:21:25 +02:00 committed by Clément Renault
parent e6c033bd6b
commit e533e740d4
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
17 changed files with 1358 additions and 833 deletions

View file

@ -1,10 +1,6 @@
use crate::{
autobatcher::BatchKind,
task::{KindWithContent, Task},
Error, IndexScheduler, Result, TaskId,
};
use crate::{autobatcher::BatchKind, Error, IndexScheduler, Result, TaskId};
use meilisearch_types::tasks::{Details, Kind, Status};
use meilisearch_types::tasks::{Details, Kind, KindWithContent, Status, Task};
use log::{debug, info};
use meilisearch_types::milli::update::IndexDocumentsConfig;
@ -432,7 +428,7 @@ impl IndexScheduler {
.map(|task_id| {
self.get_task(rtxn, task_id)
.and_then(|task| task.ok_or(Error::CorruptedTaskQueue))
.map(|task| (task.uid, task.kind.as_kind()))
.map(|task| (task.uid, task.kind))
})
.collect::<Result<Vec<_>>>()?;
@ -862,9 +858,7 @@ impl IndexScheduler {
(bitmap.remove(task.uid));
})?;
task.remove_data()?;
self.all_tasks.delete(wtxn, &task_id)?;
Ok(())
}
}