mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 14:54:27 +01:00
Update index-scheduler/src/batch.rs
Co-authored-by: Tamo <tamo@meilisearch.com>
This commit is contained in:
parent
1b8871a585
commit
055ca3935b
@ -17,10 +17,9 @@ tasks individally, but should be much faster since we are only performing
|
|||||||
one indexing operation.
|
one indexing operation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use core::fmt;
|
|
||||||
use std::borrow::Cow;
|
|
||||||
use std::collections::{BTreeSet, HashSet};
|
use std::collections::{BTreeSet, HashSet};
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
|
use std::fmt;
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::BufWriter;
|
use std::io::BufWriter;
|
||||||
|
|
||||||
@ -206,20 +205,20 @@ impl fmt::Display for Batch {
|
|||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let index_uid = self.index_uid();
|
let index_uid = self.index_uid();
|
||||||
let tasks = self.ids();
|
let tasks = self.ids();
|
||||||
let task = match self {
|
match self {
|
||||||
Batch::TaskCancelation { .. } => Cow::Borrowed("TaskCancelation"),
|
Batch::TaskCancelation { .. } => f.write_str("TaskCancelation")?,
|
||||||
Batch::TaskDeletion(_) => Cow::Borrowed("TaskDeletion"),
|
Batch::TaskDeletion(_) => f.write_str("TaskDeletion")?,
|
||||||
Batch::SnapshotCreation(_) => Cow::Borrowed("SnapshotCreation"),
|
Batch::SnapshotCreation(_) => f.write_str("SnapshotCreation")?,
|
||||||
Batch::Dump(_) => Cow::Borrowed("Dump"),
|
Batch::Dump(_) => f.write_str("Dump")?,
|
||||||
Batch::IndexOperation { op, .. } => Cow::Owned(op.to_string()),
|
Batch::IndexOperation { op, .. } => write!(f, "{op}")?,
|
||||||
Batch::IndexCreation { .. } => Cow::Borrowed("IndexCreation"),
|
Batch::IndexCreation { .. } => f.write_str("IndexCreation")?,
|
||||||
Batch::IndexUpdate { .. } => Cow::Borrowed("IndexUpdate"),
|
Batch::IndexUpdate { .. } => f.write_str("IndexUpdate")?,
|
||||||
Batch::IndexDeletion { .. } => Cow::Borrowed("IndexDeletion"),
|
Batch::IndexDeletion { .. } => f.write_str("IndexDeletion")?,
|
||||||
Batch::IndexSwap { .. } => Cow::Borrowed("IndexSwap"),
|
Batch::IndexSwap { .. } => f.write_str("IndexSwap")?,
|
||||||
};
|
};
|
||||||
match index_uid {
|
match index_uid {
|
||||||
Some(name) => f.write_fmt(format_args!("{task} on {name:?} from tasks: {tasks:?}")),
|
Some(name) => f.write_fmt(format_args!(" on {name:?} from tasks: {tasks:?}")),
|
||||||
None => f.write_fmt(format_args!("{task} from tasks: {tasks:?}")),
|
None => f.write_fmt(format_args!(" from tasks: {tasks:?}")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user