mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 03:55:07 +08:00
Prefer using an u64 instead of a usize in some places
This commit is contained in:
parent
79c4275bfc
commit
3cbfacb616
@ -970,11 +970,7 @@ impl IndexScheduler {
|
|||||||
/// Delete each given task from all the databases (if it is deleteable).
|
/// Delete each given task from all the databases (if it is deleteable).
|
||||||
///
|
///
|
||||||
/// Return the number of tasks that were actually deleted.
|
/// Return the number of tasks that were actually deleted.
|
||||||
fn delete_matched_tasks(
|
fn delete_matched_tasks(&self, wtxn: &mut RwTxn, matched_tasks: &RoaringBitmap) -> Result<u64> {
|
||||||
&self,
|
|
||||||
wtxn: &mut RwTxn,
|
|
||||||
matched_tasks: &RoaringBitmap,
|
|
||||||
) -> Result<usize> {
|
|
||||||
// 1. Remove from this list the tasks that we are not allowed to delete
|
// 1. Remove from this list the tasks that we are not allowed to delete
|
||||||
let enqueued_tasks = self.get_status(wtxn, Status::Enqueued)?;
|
let enqueued_tasks = self.get_status(wtxn, Status::Enqueued)?;
|
||||||
let processing_tasks = &self.processing_tasks.read().unwrap().processing.clone();
|
let processing_tasks = &self.processing_tasks.read().unwrap().processing.clone();
|
||||||
@ -1021,7 +1017,7 @@ impl IndexScheduler {
|
|||||||
self.all_tasks.delete(wtxn, &BEU32::new(task))?;
|
self.all_tasks.delete(wtxn, &BEU32::new(task))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(to_delete_tasks.len() as usize)
|
Ok(to_delete_tasks.len())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Cancel each given task from all the databases (if it is cancelable).
|
/// Cancel each given task from all the databases (if it is cancelable).
|
||||||
@ -1032,7 +1028,7 @@ impl IndexScheduler {
|
|||||||
wtxn: &mut RwTxn,
|
wtxn: &mut RwTxn,
|
||||||
cancel_task_id: TaskId,
|
cancel_task_id: TaskId,
|
||||||
matched_tasks: &RoaringBitmap,
|
matched_tasks: &RoaringBitmap,
|
||||||
) -> Result<usize> {
|
) -> Result<u64> {
|
||||||
let now = OffsetDateTime::now_utc();
|
let now = OffsetDateTime::now_utc();
|
||||||
|
|
||||||
// 1. Remove from this list the tasks that we are not allowed to cancel
|
// 1. Remove from this list the tasks that we are not allowed to cancel
|
||||||
@ -1050,6 +1046,6 @@ impl IndexScheduler {
|
|||||||
self.update_task(wtxn, &task)?;
|
self.update_task(wtxn, &task)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(tasks_to_cancel.len() as usize)
|
Ok(tasks_to_cancel.len())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,9 +109,9 @@ pub struct DetailsView {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub matched_tasks: Option<u64>,
|
pub matched_tasks: Option<u64>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub canceled_tasks: Option<Option<usize>>,
|
pub canceled_tasks: Option<Option<u64>>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub deleted_tasks: Option<Option<usize>>,
|
pub deleted_tasks: Option<Option<u64>>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub original_query: Option<String>,
|
pub original_query: Option<String>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -405,12 +405,12 @@ pub enum Details {
|
|||||||
},
|
},
|
||||||
TaskCancelation {
|
TaskCancelation {
|
||||||
matched_tasks: u64,
|
matched_tasks: u64,
|
||||||
canceled_tasks: Option<usize>,
|
canceled_tasks: Option<u64>,
|
||||||
original_query: String,
|
original_query: String,
|
||||||
},
|
},
|
||||||
TaskDeletion {
|
TaskDeletion {
|
||||||
matched_tasks: u64,
|
matched_tasks: u64,
|
||||||
deleted_tasks: Option<usize>,
|
deleted_tasks: Option<u64>,
|
||||||
original_query: String,
|
original_query: String,
|
||||||
},
|
},
|
||||||
Dump {
|
Dump {
|
||||||
|
Loading…
Reference in New Issue
Block a user