mirror of
https://github.com/flibusta-apps/batch_downloader.git
synced 2025-12-06 14:25:36 +01:00
Fixes
This commit is contained in:
@@ -11,7 +11,7 @@ pub fn get_minio() -> Minio {
|
||||
);
|
||||
|
||||
Minio::builder()
|
||||
.host(&config::CONFIG.minio_host)
|
||||
.endpoint(&config::CONFIG.minio_host)
|
||||
.provider(provider)
|
||||
.secure(false)
|
||||
.build()
|
||||
|
||||
@@ -55,7 +55,7 @@ where
|
||||
pub async fn set_task_error(key: String, error_message: String) {
|
||||
let task = Task {
|
||||
id: key.clone(),
|
||||
status: crate::structures::TaskStatus::Failled,
|
||||
status: crate::structures::TaskStatus::Failed,
|
||||
status_description: "Ошибка!".to_string(),
|
||||
error_message: Some(error_message),
|
||||
result_filename: None,
|
||||
@@ -97,7 +97,8 @@ pub async fn upload_to_minio(archive: SpooledTempFile, filename: String) -> Resu
|
||||
|
||||
if let Err(err) = minio.put_object_stream(
|
||||
ObjectArgs::new(&config::CONFIG.minio_bucket, filename.clone()),
|
||||
Box::pin(data_stream)
|
||||
Box::pin(data_stream),
|
||||
None
|
||||
).await {
|
||||
return Err(Box::new(err));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ pub enum TaskStatus {
|
||||
InProgress,
|
||||
Archiving,
|
||||
Complete,
|
||||
Failled
|
||||
Failed
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
|
||||
@@ -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, self}, 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;
|
||||
@@ -20,13 +20,13 @@ pub static TASK_RESULTS: Lazy<Cache<String, Task>> = Lazy::new(|| {
|
||||
|
||||
|
||||
async fn create_archive_task(
|
||||
extract::Json(data): extract::Json<CreateTask>
|
||||
Json(data): Json<CreateTask>
|
||||
) -> impl IntoResponse {
|
||||
let key = get_key(data.clone());
|
||||
|
||||
let result = match TASK_RESULTS.get(&key) {
|
||||
Some(result) => {
|
||||
if result.status == TaskStatus::Failled {
|
||||
if result.status == TaskStatus::Failed {
|
||||
create_task(data).await
|
||||
} else {
|
||||
result
|
||||
|
||||
Reference in New Issue
Block a user