mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Use a tokio block_in_place method for potentially blocking tasks
This commit is contained in:
parent
afafe8d207
commit
4f1c0535b4
1 changed files with 3 additions and 4 deletions
|
@ -10,6 +10,7 @@ use serde::{Deserialize, Serialize};
|
|||
use serde_cs::vec::CS;
|
||||
use serde_json::json;
|
||||
use time::{Duration, OffsetDateTime};
|
||||
use tokio::task::block_in_place;
|
||||
|
||||
use crate::analytics::Analytics;
|
||||
use crate::extractors::authentication::{policies::*, GuardedData};
|
||||
|
@ -249,8 +250,7 @@ async fn cancel_tasks(
|
|||
tasks,
|
||||
};
|
||||
|
||||
// TODO add a tokio_spawn
|
||||
let task = index_scheduler.register(task_cancelation)?;
|
||||
let task = block_in_place(|| index_scheduler.register(task_cancelation))?;
|
||||
let task_view = TaskView::from_task(&task);
|
||||
|
||||
Ok(HttpResponse::Ok().json(task_view))
|
||||
|
@ -294,8 +294,7 @@ async fn delete_tasks(
|
|||
tasks,
|
||||
};
|
||||
|
||||
// TODO add a tokio_spawn
|
||||
let task = index_scheduler.register(task_deletion)?;
|
||||
let task = block_in_place(|| index_scheduler.register(task_deletion))?;
|
||||
let task_view = TaskView::from_task(&task);
|
||||
|
||||
Ok(HttpResponse::Ok().json(task_view))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue