mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
make Task index_uid an option
Not all task relate to an index. Tasks that don't have an index_uid set to None
This commit is contained in:
parent
9935db86c7
commit
aa50acb031
8 changed files with 79 additions and 35 deletions
|
@ -187,7 +187,7 @@ impl From<(UpdateStatus, String, TaskId)> for Task {
|
|||
// Dummy task
|
||||
let mut task = Task {
|
||||
id: task_id,
|
||||
index_uid: IndexUid::new(uid).unwrap(),
|
||||
index_uid: Some(IndexUid::new(uid).unwrap()),
|
||||
content: TaskContent::IndexDeletion,
|
||||
events: Vec::new(),
|
||||
};
|
||||
|
|
|
@ -419,7 +419,7 @@ where
|
|||
Update::UpdateIndex { primary_key } => TaskContent::IndexUpdate { primary_key },
|
||||
};
|
||||
|
||||
let task = self.task_store.register(uid, content).await?;
|
||||
let task = self.task_store.register(Some(uid), content).await?;
|
||||
self.scheduler.read().await.notify();
|
||||
|
||||
Ok(task)
|
||||
|
@ -569,7 +569,12 @@ where
|
|||
// Check if the currently indexing update is from our index.
|
||||
let is_indexing = processing_tasks
|
||||
.first()
|
||||
.map(|task| task.index_uid.as_str() == uid)
|
||||
.map(|task| {
|
||||
task.index_uid
|
||||
.as_ref()
|
||||
.map(|u| u.as_str() == uid)
|
||||
.unwrap_or(false)
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
let index = self.index_resolver.get_index(uid).await?;
|
||||
|
@ -605,7 +610,7 @@ where
|
|||
// Check if the currently indexing update is from our index.
|
||||
stats.is_indexing = processing_tasks
|
||||
.first()
|
||||
.map(|p| p.index_uid.as_str() == index_uid)
|
||||
.and_then(|p| p.index_uid.as_ref().map(|u| u.as_str() == index_uid))
|
||||
.or(Some(false));
|
||||
|
||||
indexes.insert(index_uid, stats);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue