mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 00:55:00 +08:00
Get rids of the unecessary tasks when an index_uid is specified
This commit is contained in:
parent
d16ea755d8
commit
01687c87a2
@ -589,10 +589,12 @@ impl IndexScheduler {
|
|||||||
) -> Result<RoaringBitmap> {
|
) -> Result<RoaringBitmap> {
|
||||||
let mut tasks = self.get_task_ids(rtxn, query)?;
|
let mut tasks = self.get_task_ids(rtxn, query)?;
|
||||||
|
|
||||||
// If the query contains a list of index_uid, then we must exclude IndexSwap tasks
|
// If the query contains a list of `index_uid`, then we must exclude all the kind that
|
||||||
// from the result (because it is not publicly associated with any index)
|
// arn't associated to one and only one index.
|
||||||
if query.index_uid.is_some() {
|
if query.index_uid.is_some() {
|
||||||
tasks -= self.get_kind(rtxn, Kind::IndexSwap)?
|
for kind in enum_iterator::all::<Kind>().filter(|kind| !kind.related_to_one_index()) {
|
||||||
|
tasks -= self.get_kind(rtxn, kind)?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Any task that is internally associated with a non-authorized index
|
// Any task that is internally associated with a non-authorized index
|
||||||
|
@ -381,6 +381,24 @@ pub enum Kind {
|
|||||||
SnapshotCreation,
|
SnapshotCreation,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Kind {
|
||||||
|
pub fn related_to_one_index(&self) -> bool {
|
||||||
|
match self {
|
||||||
|
Kind::DocumentAdditionOrUpdate
|
||||||
|
| Kind::DocumentDeletion
|
||||||
|
| Kind::SettingsUpdate
|
||||||
|
| Kind::IndexCreation
|
||||||
|
| Kind::IndexDeletion
|
||||||
|
| Kind::IndexUpdate => true,
|
||||||
|
Kind::IndexSwap
|
||||||
|
| Kind::TaskCancelation
|
||||||
|
| Kind::TaskDeletion
|
||||||
|
| Kind::DumpCreation
|
||||||
|
| Kind::SnapshotCreation => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl FromStr for Kind {
|
impl FromStr for Kind {
|
||||||
type Err = ResponseError;
|
type Err = ResponseError;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user