This commit is contained in:
parent
705f4c55d0
commit
97911e034a
|
@ -96,12 +96,14 @@ impl AppState {
|
|||
let filelist = get_s3_filelist(&self.storj_client, &self.storj_bucket).await;
|
||||
|
||||
for [filename, filepath] in filelist.clone() {
|
||||
if !filepath.starts_with("/development") {
|
||||
// Сохраняем список файлов в Redis, используя HSET для каждого файла
|
||||
let _: () = redis
|
||||
.hset(PATH_MAPPING_KEY, filename.clone(), filepath)
|
||||
.await
|
||||
.expect(&format!("Failed to cache file {} in Redis", filename));
|
||||
}
|
||||
}
|
||||
|
||||
info!("cached {} files", filelist.len());
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ pub async fn serve_file(filepath: &str, state: &AppState) -> Result<HttpResponse
|
|||
// Проверяем наличие файла в Storj S3
|
||||
let exists = check_file_exists(&state.storj_client, &state.storj_bucket, &filepath).await?;
|
||||
if !exists {
|
||||
return Err(ErrorInternalServerError("File not found in Storj".to_string()));
|
||||
return Err(ErrorInternalServerError(format!("File {} not found in Storj", filepath)));
|
||||
}
|
||||
|
||||
// Получаем объект из Storj S3
|
||||
|
|
Loading…
Reference in New Issue
Block a user