mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 04:17:10 +02:00
Add the tasks cancel route to cancel tasks
This commit is contained in:
parent
01ed1fb128
commit
973e2f71eb
6 changed files with 73 additions and 8 deletions
|
@ -17,9 +17,10 @@ pub enum Error {
|
|||
CorruptedDump,
|
||||
#[error("Task `{0}` not found")]
|
||||
TaskNotFound(TaskId),
|
||||
// TODO: Lo: proper error message for this
|
||||
#[error("Cannot delete all tasks")]
|
||||
#[error("Query parameters to filter the tasks to delete are missing. Available query parameters are: `uid`, `indexUid`, `status`, `type`")]
|
||||
TaskDeletionWithEmptyQuery,
|
||||
#[error("Query parameters to filter the tasks to cancel are missing. Available query parameters are: `uid`, `indexUid`, `status`, `type`")]
|
||||
TaskCancelationWithEmptyQuery,
|
||||
// maybe the two next errors are going to move to the frontend
|
||||
#[error("`{0}` is not a status. Available status are")]
|
||||
InvalidStatus(String),
|
||||
|
@ -48,6 +49,7 @@ impl ErrorCode for Error {
|
|||
Error::IndexAlreadyExists(_) => Code::IndexAlreadyExists,
|
||||
Error::TaskNotFound(_) => Code::TaskNotFound,
|
||||
Error::TaskDeletionWithEmptyQuery => Code::TaskDeletionWithEmptyQuery,
|
||||
Error::TaskCancelationWithEmptyQuery => Code::TaskCancelationWithEmptyQuery,
|
||||
Error::InvalidStatus(_) => Code::BadRequest,
|
||||
Error::InvalidKind(_) => Code::BadRequest,
|
||||
|
||||
|
|
|
@ -829,7 +829,7 @@ mod tests {
|
|||
replace_document_import_task("catto", None, 0, 12),
|
||||
KindWithContent::TaskCancelation {
|
||||
query: format!("uid=0,1"),
|
||||
tasks: vec![0, 1],
|
||||
tasks: RoaringBitmap::from_iter([0, 1]),
|
||||
},
|
||||
replace_document_import_task("catto", None, 1, 50),
|
||||
replace_document_import_task("doggo", Some("bone"), 2, 5000),
|
||||
|
|
|
@ -104,6 +104,7 @@ fn snapshot_task(task: &Task) -> String {
|
|||
started_at: _,
|
||||
finished_at: _,
|
||||
error,
|
||||
canceled_by: _,
|
||||
details,
|
||||
status,
|
||||
kind,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue