Prefer using an u64 instead of a usize in some places

This commit is contained in:
Kerollmops 2022-10-19 11:09:40 +02:00 committed by Clément Renault
parent 79c4275bfc
commit 3cbfacb616
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
3 changed files with 8 additions and 12 deletions

View File

@ -970,11 +970,7 @@ impl IndexScheduler {
/// Delete each given task from all the databases (if it is deleteable).
///
/// Return the number of tasks that were actually deleted.
fn delete_matched_tasks(
&self,
wtxn: &mut RwTxn,
matched_tasks: &RoaringBitmap,
) -> Result<usize> {
fn delete_matched_tasks(&self, wtxn: &mut RwTxn, matched_tasks: &RoaringBitmap) -> Result<u64> {
// 1. Remove from this list the tasks that we are not allowed to delete
let enqueued_tasks = self.get_status(wtxn, Status::Enqueued)?;
let processing_tasks = &self.processing_tasks.read().unwrap().processing.clone();
@ -1021,7 +1017,7 @@ impl IndexScheduler {
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).
@ -1032,7 +1028,7 @@ impl IndexScheduler {
wtxn: &mut RwTxn,
cancel_task_id: TaskId,
matched_tasks: &RoaringBitmap,
) -> Result<usize> {
) -> Result<u64> {
let now = OffsetDateTime::now_utc();
// 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)?;
}
Ok(tasks_to_cancel.len() as usize)
Ok(tasks_to_cancel.len())
}
}

View File

@ -109,9 +109,9 @@ pub struct DetailsView {
#[serde(skip_serializing_if = "Option::is_none")]
pub matched_tasks: Option<u64>,
#[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")]
pub deleted_tasks: Option<Option<usize>>,
pub deleted_tasks: Option<Option<u64>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub original_query: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]

View File

@ -405,12 +405,12 @@ pub enum Details {
},
TaskCancelation {
matched_tasks: u64,
canceled_tasks: Option<usize>,
canceled_tasks: Option<u64>,
original_query: String,
},
TaskDeletion {
matched_tasks: u64,
deleted_tasks: Option<usize>,
deleted_tasks: Option<u64>,
original_query: String,
},
Dump {