Apply suggested changes from PR review

This commit is contained in:
Loïc Lecrenier 2022-10-15 11:03:24 +02:00 committed by Clément Renault
parent 441417447e
commit fbd2be2ec8
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
3 changed files with 3 additions and 6 deletions

View File

@ -840,7 +840,7 @@ impl IndexScheduler {
let mut affected_kinds = HashSet::new(); let mut affected_kinds = HashSet::new();
for task_id in to_delete_tasks.iter() { for task_id in to_delete_tasks.iter() {
if let Some(task) = self.all_tasks.get(wtxn, &BEU32::new(task_id))? { if let Some(task) = self.get_task(wtxn, task_id)? {
if let Some(task_indexes) = task.indexes() { if let Some(task_indexes) = task.indexes() {
affected_indexes.extend(task_indexes.into_iter().map(|x| x.to_owned())); affected_indexes.extend(task_indexes.into_iter().map(|x| x.to_owned()));
} }

View File

@ -1,6 +1,5 @@
use actix_web::web::Data; use actix_web::web::Data;
use actix_web::{web, HttpRequest, HttpResponse}; use actix_web::{web, HttpRequest, HttpResponse};
use env_logger::filter;
use index_scheduler::{IndexScheduler, Query, TaskId}; use index_scheduler::{IndexScheduler, Query, TaskId};
use meilisearch_types::error::ResponseError; use meilisearch_types::error::ResponseError;
use meilisearch_types::index_uid::IndexUid; use meilisearch_types::index_uid::IndexUid;
@ -188,8 +187,6 @@ pub struct TaskDeletionQuery {
async fn delete_tasks( async fn delete_tasks(
index_scheduler: GuardedData<ActionPolicy<{ actions::TASKS_DELETE }>, Data<IndexScheduler>>, index_scheduler: GuardedData<ActionPolicy<{ actions::TASKS_DELETE }>, Data<IndexScheduler>>,
params: web::Query<TaskDeletionQuery>, params: web::Query<TaskDeletionQuery>,
_req: HttpRequest,
_analytics: web::Data<dyn Analytics>,
) -> Result<HttpResponse, ResponseError> { ) -> Result<HttpResponse, ResponseError> {
let TaskDeletionQuery { let TaskDeletionQuery {
type_, type_,
@ -221,7 +218,7 @@ async fn delete_tasks(
query: filtered_query_string, query: filtered_query_string,
tasks, tasks,
}; };
// TODO: Lo: analytics
let task = index_scheduler.register(task_deletion)?; let task = index_scheduler.register(task_deletion)?;
let task_view = TaskView::from_task(&task); let task_view = TaskView::from_task(&task);

View File

@ -224,7 +224,7 @@ pub enum Action {
IndexesDelete, IndexesDelete,
#[serde(rename = "tasks.*")] #[serde(rename = "tasks.*")]
TasksAll, TasksAll,
#[serde(rename = "tasks.*")] #[serde(rename = "tasks.delete")]
TasksDelete, TasksDelete,
#[serde(rename = "tasks.get")] #[serde(rename = "tasks.get")]
TasksGet, TasksGet,