mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
fix the return of the task cancelation and task deletion
This commit is contained in:
parent
6280bd51a9
commit
6c2ecec4d0
@ -12,7 +12,6 @@ use crate::error::MeilisearchHttpError;
|
|||||||
use crate::extractors::authentication::policies::*;
|
use crate::extractors::authentication::policies::*;
|
||||||
use crate::extractors::authentication::{AuthenticationError, GuardedData};
|
use crate::extractors::authentication::{AuthenticationError, GuardedData};
|
||||||
use crate::extractors::sequential_extractor::SeqHandler;
|
use crate::extractors::sequential_extractor::SeqHandler;
|
||||||
use crate::routes::tasks::TaskView;
|
|
||||||
|
|
||||||
pub fn configure(cfg: &mut web::ServiceConfig) {
|
pub fn configure(cfg: &mut web::ServiceConfig) {
|
||||||
cfg.service(web::resource("").route(web::post().to(SeqHandler(swap_indexes))));
|
cfg.service(web::resource("").route(web::post().to(SeqHandler(swap_indexes))));
|
||||||
|
@ -14,7 +14,7 @@ use serde_json::json;
|
|||||||
use time::{Duration, OffsetDateTime};
|
use time::{Duration, OffsetDateTime};
|
||||||
use tokio::task;
|
use tokio::task;
|
||||||
|
|
||||||
use super::fold_star_or;
|
use super::{fold_star_or, SummarizedTaskView};
|
||||||
use crate::analytics::Analytics;
|
use crate::analytics::Analytics;
|
||||||
use crate::extractors::authentication::policies::*;
|
use crate::extractors::authentication::policies::*;
|
||||||
use crate::extractors::authentication::GuardedData;
|
use crate::extractors::authentication::GuardedData;
|
||||||
@ -297,9 +297,9 @@ async fn cancel_tasks(
|
|||||||
KindWithContent::TaskCancelation { query: req.query_string().to_string(), tasks };
|
KindWithContent::TaskCancelation { query: req.query_string().to_string(), tasks };
|
||||||
|
|
||||||
let task = task::spawn_blocking(move || index_scheduler.register(task_cancelation)).await??;
|
let task = task::spawn_blocking(move || index_scheduler.register(task_cancelation)).await??;
|
||||||
let task_view = TaskView::from_task(&task);
|
let task: SummarizedTaskView = task.into();
|
||||||
|
|
||||||
Ok(HttpResponse::Ok().json(task_view))
|
Ok(HttpResponse::Ok().json(task))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn delete_tasks(
|
async fn delete_tasks(
|
||||||
@ -354,9 +354,9 @@ async fn delete_tasks(
|
|||||||
KindWithContent::TaskDeletion { query: req.query_string().to_string(), tasks };
|
KindWithContent::TaskDeletion { query: req.query_string().to_string(), tasks };
|
||||||
|
|
||||||
let task = task::spawn_blocking(move || index_scheduler.register(task_deletion)).await??;
|
let task = task::spawn_blocking(move || index_scheduler.register(task_deletion)).await??;
|
||||||
let task_view = TaskView::from_task(&task);
|
let task: SummarizedTaskView = task.into();
|
||||||
|
|
||||||
Ok(HttpResponse::Ok().json(task_view))
|
Ok(HttpResponse::Ok().json(task))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
|
Loading…
Reference in New Issue
Block a user