mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 21:04:27 +01:00
Clean up some code
This commit is contained in:
parent
861a07792e
commit
2ba5e3b519
@ -403,7 +403,6 @@ impl IndexScheduler {
|
|||||||
let to_delete = self.get_kind(rtxn, Kind::TaskDeletion)? & enqueued;
|
let to_delete = self.get_kind(rtxn, Kind::TaskDeletion)? & enqueued;
|
||||||
if let Some(task_id) = to_delete.min() {
|
if let Some(task_id) = to_delete.min() {
|
||||||
let task = self.get_task(rtxn, task_id)?.ok_or(Error::CorruptedTaskQueue)?;
|
let task = self.get_task(rtxn, task_id)?.ok_or(Error::CorruptedTaskQueue)?;
|
||||||
|
|
||||||
return Ok(Some(Batch::TaskDeletion(task)));
|
return Ok(Some(Batch::TaskDeletion(task)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -876,9 +875,9 @@ impl IndexScheduler {
|
|||||||
*lhs_tasks -= &index_lhs_task_ids;
|
*lhs_tasks -= &index_lhs_task_ids;
|
||||||
*lhs_tasks |= &index_rhs_task_ids;
|
*lhs_tasks |= &index_rhs_task_ids;
|
||||||
})?;
|
})?;
|
||||||
self.update_index(wtxn, rhs, |lhs_tasks| {
|
self.update_index(wtxn, rhs, |rhs_tasks| {
|
||||||
*lhs_tasks -= &index_rhs_task_ids;
|
*rhs_tasks -= &index_rhs_task_ids;
|
||||||
*lhs_tasks |= &index_lhs_task_ids;
|
*rhs_tasks |= &index_lhs_task_ids;
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// 6. Swap in the index mapper
|
// 6. Swap in the index mapper
|
||||||
|
@ -257,11 +257,6 @@ pub struct IndexScheduler {
|
|||||||
pub(crate) index_tasks: Database<Str, RoaringBitmapCodec>,
|
pub(crate) index_tasks: Database<Str, RoaringBitmapCodec>,
|
||||||
|
|
||||||
/// Store the task ids of tasks which were enqueued at a specific date
|
/// Store the task ids of tasks which were enqueued at a specific date
|
||||||
///
|
|
||||||
/// Note that since we store the date with nanosecond-level precision, it would be
|
|
||||||
/// reasonable to assume that there is only one task per key. However, it is not a
|
|
||||||
/// theoretical certainty, and we might want to make it possible to enqueue multiple
|
|
||||||
/// tasks at a time in the future.
|
|
||||||
pub(crate) enqueued_at: Database<OwnedType<BEI128>, CboRoaringBitmapCodec>,
|
pub(crate) enqueued_at: Database<OwnedType<BEI128>, CboRoaringBitmapCodec>,
|
||||||
|
|
||||||
/// Store the task ids of finished tasks which started being processed at a specific date
|
/// Store the task ids of finished tasks which started being processed at a specific date
|
||||||
@ -299,14 +294,14 @@ pub struct IndexScheduler {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
test_breakpoint_sdr: crossbeam::channel::Sender<(Breakpoint, bool)>,
|
test_breakpoint_sdr: crossbeam::channel::Sender<(Breakpoint, bool)>,
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
/// A list of planned failures within the [`tick`](IndexScheduler::tick) method of the index scheduler.
|
/// A list of planned failures within the [`tick`](IndexScheduler::tick) method of the index scheduler.
|
||||||
///
|
///
|
||||||
/// The first field is the iteration index and the second field identifies a location in the code.
|
/// The first field is the iteration index and the second field identifies a location in the code.
|
||||||
|
#[cfg(test)]
|
||||||
planned_failures: Vec<(usize, tests::FailureLocation)>,
|
planned_failures: Vec<(usize, tests::FailureLocation)>,
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
/// A counter that is incremented before every call to [`tick`](IndexScheduler::tick)
|
/// A counter that is incremented before every call to [`tick`](IndexScheduler::tick)
|
||||||
|
#[cfg(test)]
|
||||||
run_loop_iteration: Arc<RwLock<usize>>,
|
run_loop_iteration: Arc<RwLock<usize>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,9 +417,7 @@ impl IndexScheduler {
|
|||||||
| Error::HeedTransaction(_)
|
| Error::HeedTransaction(_)
|
||||||
| Error::CreateBatch(_)
|
| Error::CreateBatch(_)
|
||||||
) {
|
) {
|
||||||
{
|
std::thread::sleep(Duration::from_secs(1));
|
||||||
std::thread::sleep(Duration::from_secs(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -633,7 +626,7 @@ impl IndexScheduler {
|
|||||||
})?;
|
})?;
|
||||||
|
|
||||||
self.update_kind(&mut wtxn, task.kind.as_kind(), |bitmap| {
|
self.update_kind(&mut wtxn, task.kind.as_kind(), |bitmap| {
|
||||||
(bitmap.insert(task.uid));
|
bitmap.insert(task.uid);
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
utils::insert_task_datetime(&mut wtxn, self.enqueued_at, task.enqueued_at, task.uid)?;
|
utils::insert_task_datetime(&mut wtxn, self.enqueued_at, task.enqueued_at, task.uid)?;
|
||||||
@ -914,6 +907,7 @@ impl IndexScheduler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.processing_tasks.write().unwrap().stop_processing_at(finished_at);
|
self.processing_tasks.write().unwrap().stop_processing_at(finished_at);
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Loading…
Reference in New Issue
Block a user