mirror of
https://github.com/flibusta-apps/batch_downloader.git
synced 2025-12-06 14:25:36 +01:00
Fix
This commit is contained in:
@@ -3,7 +3,7 @@ use smallvec::SmallVec;
|
||||
use smartstring::alias::String as SmartString;
|
||||
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
#[derive(Serialize, Clone, PartialEq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum TaskStatus {
|
||||
InProgress,
|
||||
|
||||
10
src/views.rs
10
src/views.rs
@@ -8,7 +8,7 @@ use tower_http::trace::{TraceLayer, self};
|
||||
|
||||
use tracing::Level;
|
||||
|
||||
use crate::{config::CONFIG, structures::{Task, CreateTask}, services::{task_creator::create_task, utils::get_key}};
|
||||
use crate::{config::CONFIG, structures::{Task, CreateTask, TaskStatus}, services::{task_creator::create_task, utils::get_key}};
|
||||
|
||||
|
||||
pub static TASK_RESULTS: Lazy<Cache<String, Task>> = Lazy::new(|| {
|
||||
@@ -25,7 +25,13 @@ async fn create_archive_task(
|
||||
let key = get_key(data.clone());
|
||||
|
||||
let result = match TASK_RESULTS.get(&key) {
|
||||
Some(result) => result,
|
||||
Some(result) => {
|
||||
if result.status == TaskStatus::Failled {
|
||||
create_task(data).await
|
||||
} else {
|
||||
result
|
||||
}
|
||||
},
|
||||
None => create_task(data).await,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user