From a25e16132c9157b1d46db73dcde66160b05ff877 Mon Sep 17 00:00:00 2001 From: Untone Date: Tue, 22 Oct 2024 12:58:01 +0300 Subject: [PATCH] minorfix3 --- src/app_state.rs | 13 +------------ src/main.rs | 1 - 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/app_state.rs b/src/app_state.rs index b404561..896bc90 100644 --- a/src/app_state.rs +++ b/src/app_state.rs @@ -2,8 +2,7 @@ use actix_web::error::ErrorInternalServerError; use aws_config::BehaviorVersion; use aws_sdk_s3::{config::Credentials, Client as S3Client}; use redis::{aio::MultiplexedConnection, AsyncCommands, Client as RedisClient}; -use std::{env, time::Duration}; -use tokio::time::interval; +use std::env; use std::collections::HashMap; use log::info; use crate::s3_utils::get_s3_filelist; @@ -17,7 +16,6 @@ pub struct AppState { } const PATH_MAPPING_KEY: &str = "filepath_mapping"; // Ключ для хранения маппинга путей -const CHECK_INTERVAL_SECONDS: u64 = 60 * 60; // Интервал обновления списка файлов: 1 час const WEEK_SECONDS: u64 = 604800; impl AppState { @@ -117,15 +115,6 @@ impl AppState { // Преобразуем HashMap в Vec, используя значения (пути файлов) cached_list.into_values().collect() } - - /// Периодически обновляет кэшированный список файлов из Storj S3. - pub async fn refresh_file_list_periodically(&self) { - let mut interval = interval(Duration::from_secs(CHECK_INTERVAL_SECONDS)); - loop { - interval.tick().await; - self.cache_storj_filelist().await; - } - } /// Получает путь в Storj из ключа (имени файла) в Redis. pub async fn get_path(&self, file_key: &str) -> Result, actix_web::Error> { diff --git a/src/main.rs b/src/main.rs index 86f8e11..c102ad2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,7 +23,6 @@ async fn main() -> std::io::Result<()> { let rt = tokio::runtime::Handle::current(); rt.block_on(async move { app_state_clone.cache_storj_filelist().await; - app_state_clone.refresh_file_list_periodically().await; }); });