mirror of
https://github.com/flibusta-apps/batch_downloader.git
synced 2025-12-06 06:15:37 +01:00
Update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use axum::{Router, routing::{get, post}, middleware::{self, Next}, http::{Request, StatusCode, self}, response::{Response, IntoResponse}, extract::{Path}, Json};
|
||||
use axum::{Router, routing::{get, post}, middleware::{self, Next}, http::{Request, StatusCode, self}, response::{Response, IntoResponse}, extract::Path, Json};
|
||||
use axum_prometheus::PrometheusMetricLayer;
|
||||
use moka::future::Cache;
|
||||
use once_cell::sync::Lazy;
|
||||
@@ -24,7 +24,7 @@ async fn create_archive_task(
|
||||
) -> impl IntoResponse {
|
||||
let key = get_key(data.clone());
|
||||
|
||||
let result = match TASK_RESULTS.get(&key) {
|
||||
let result = match TASK_RESULTS.get(&key).await {
|
||||
Some(result) => {
|
||||
if result.status == TaskStatus::Failed {
|
||||
create_task(data).await
|
||||
@@ -42,7 +42,7 @@ async fn create_archive_task(
|
||||
async fn check_archive_task_status(
|
||||
Path(task_id): Path<String>
|
||||
) -> impl IntoResponse {
|
||||
match TASK_RESULTS.get(&task_id) {
|
||||
match TASK_RESULTS.get(&task_id).await {
|
||||
Some(result) => Json::<Task>(result).into_response(),
|
||||
None => StatusCode::NOT_FOUND.into_response(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user