mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-30 23:27:36 +01:00
make sure the batches we snapshots actually all contains an enqueued_at
This commit is contained in:
parent
485e3127c7
commit
e0f0da57e2
@ -345,10 +345,10 @@ pub fn snapshot_batch(batch: &Batch) -> String {
|
||||
if let Some(finished_at) = finished_at {
|
||||
assert!(finished_at > started_at);
|
||||
}
|
||||
if let Some(BatchEnqueuedAt { earliest, oldest }) = enqueued_at {
|
||||
assert!(started_at > earliest);
|
||||
assert!(earliest >= oldest);
|
||||
}
|
||||
let BatchEnqueuedAt { earliest, oldest } = enqueued_at.unwrap();
|
||||
assert!(*started_at > earliest);
|
||||
assert!(earliest >= oldest);
|
||||
|
||||
snap.push('{');
|
||||
snap.push_str(&format!("uid: {uid}, "));
|
||||
snap.push_str(&format!("details: {}, ", serde_json::to_string(details).unwrap()));
|
||||
|
@ -359,14 +359,27 @@ impl crate::IndexScheduler {
|
||||
kind,
|
||||
} = task;
|
||||
assert_eq!(uid, task.uid);
|
||||
if let Some(ref batch) = batch_uid {
|
||||
if task.status != Status::Enqueued {
|
||||
let batch_uid = batch_uid.expect("All non enqueued tasks must be part of a batch");
|
||||
assert!(self
|
||||
.queue
|
||||
.batch_to_tasks_mapping
|
||||
.get(&rtxn, batch)
|
||||
.get(&rtxn, &batch_uid)
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.contains(uid));
|
||||
let batch = self.queue.batches.get_batch(&rtxn, batch_uid).unwrap().unwrap();
|
||||
assert_eq!(batch.uid, batch_uid);
|
||||
if task.status == Status::Processing {
|
||||
assert!(batch.progress.is_some());
|
||||
} else {
|
||||
assert!(batch.progress.is_none());
|
||||
}
|
||||
assert_eq!(batch.started_at, task.started_at.unwrap());
|
||||
assert_eq!(batch.finished_at, task.finished_at);
|
||||
let enqueued_at = batch.enqueued_at.unwrap();
|
||||
assert!(task.enqueued_at >= enqueued_at.oldest);
|
||||
assert!(task.enqueued_at <= enqueued_at.earliest);
|
||||
}
|
||||
if let Some(task_index_uid) = &task_index_uid {
|
||||
assert!(self
|
||||
|
Loading…
x
Reference in New Issue
Block a user