From 1cd3175e13cefc223f9ac0d59be32f9a8012fc86 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Fri, 5 Jul 2024 22:02:15 -0400 Subject: [PATCH] move memory caching module --- crates/service/web/storyteller_web/src/api_doc_cli.rs | 1 - crates/service/web/storyteller_web/src/api_doc_server.rs | 1 - .../inference/enqueue_voice_conversion_inference.rs | 2 +- crates/service/web/storyteller_web/src/main.rs | 3 +-- .../web/storyteller_web/src/{ => state}/memory_cache/mod.rs | 0 .../src/{ => state}/memory_cache/model_token_to_info_cache.rs | 0 crates/service/web/storyteller_web/src/state/mod.rs | 1 + crates/service/web/storyteller_web/src/state/server_state.rs | 2 +- .../src/threads/poll_model_token_info_thread.rs | 2 +- 9 files changed, 5 insertions(+), 7 deletions(-) rename crates/service/web/storyteller_web/src/{ => state}/memory_cache/mod.rs (100%) rename crates/service/web/storyteller_web/src/{ => state}/memory_cache/model_token_to_info_cache.rs (100%) diff --git a/crates/service/web/storyteller_web/src/api_doc_cli.rs b/crates/service/web/storyteller_web/src/api_doc_cli.rs index 0a6b94dee7..9b68a18c58 100644 --- a/crates/service/web/storyteller_web/src/api_doc_cli.rs +++ b/crates/service/web/storyteller_web/src/api_doc_cli.rs @@ -37,7 +37,6 @@ use crate::state::server_state::{DurableInMemoryCaches, EnvConfig, EphemeralInMe pub mod billing; pub mod configs; pub mod http_server; -pub mod memory_cache; pub mod model; pub mod state; pub mod threads; diff --git a/crates/service/web/storyteller_web/src/api_doc_server.rs b/crates/service/web/storyteller_web/src/api_doc_server.rs index 52da786495..f68953cf03 100644 --- a/crates/service/web/storyteller_web/src/api_doc_server.rs +++ b/crates/service/web/storyteller_web/src/api_doc_server.rs @@ -34,7 +34,6 @@ use crate::state::server_state::ServerState; pub mod billing; pub mod configs; pub mod http_server; -pub mod memory_cache; pub mod model; pub mod state; pub mod threads; diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/voice_conversion/inference/enqueue_voice_conversion_inference.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/voice_conversion/inference/enqueue_voice_conversion_inference.rs index 20f3a014e1..3adc2bf1d2 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/voice_conversion/inference/enqueue_voice_conversion_inference.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/voice_conversion/inference/enqueue_voice_conversion_inference.rs @@ -35,7 +35,7 @@ use tts_common::priority::FAKEYOU_INVESTOR_PRIORITY_LEVEL; use crate::configs::plans::get_correct_plan_for_session::get_correct_plan_for_session; use crate::http_server::endpoints::investor_demo::demo_cookie::request_has_demo_cookie; use crate::http_server::web_utils::response_error_helpers::to_simple_json_error; -use crate::memory_cache::model_token_to_info_cache::{ModelInfoForInferenceJob, ModelTokenToInfoCache}; +use crate::state::memory_cache::model_token_to_info_cache::{ModelInfoForInferenceJob, ModelTokenToInfoCache}; use crate::state::server_state::ServerState; /// Debug requests can get routed to special "debug-only" workers, which can diff --git a/crates/service/web/storyteller_web/src/main.rs b/crates/service/web/storyteller_web/src/main.rs index 88c2615584..3263b8f272 100644 --- a/crates/service/web/storyteller_web/src/main.rs +++ b/crates/service/web/storyteller_web/src/main.rs @@ -78,7 +78,7 @@ use crate::configs::static_api_tokens::StaticApiTokenSet; use crate::http_server::middleware::pushback_filter_middleware::PushbackFilter; use crate::http_server::routes::add_routes::add_routes; use crate::http_server::web_utils::handle_multipart_error::handle_multipart_error; -use crate::memory_cache::model_token_to_info_cache::ModelTokenToInfoCache; +use crate::state::memory_cache::model_token_to_info_cache::ModelTokenToInfoCache; use crate::state::server_state::{DurableInMemoryCaches, EnvConfig, EphemeralInMemoryCaches, InMemoryCaches, ServerInfo, ServerState, StaticFeatureFlags, StripeSettings, TrollBans}; use crate::threads::db_health_checker_thread::db_health_check_status::HealthCheckStatus; use crate::threads::db_health_checker_thread::db_health_checker_thread::db_health_checker_thread; @@ -94,7 +94,6 @@ pub const RESERVED_SUBSTRINGS : &str = include_str!("../../../../../includes/bin pub mod billing; pub mod configs; pub mod http_server; -pub mod memory_cache; pub mod model; pub mod state; pub mod threads; diff --git a/crates/service/web/storyteller_web/src/memory_cache/mod.rs b/crates/service/web/storyteller_web/src/state/memory_cache/mod.rs similarity index 100% rename from crates/service/web/storyteller_web/src/memory_cache/mod.rs rename to crates/service/web/storyteller_web/src/state/memory_cache/mod.rs diff --git a/crates/service/web/storyteller_web/src/memory_cache/model_token_to_info_cache.rs b/crates/service/web/storyteller_web/src/state/memory_cache/model_token_to_info_cache.rs similarity index 100% rename from crates/service/web/storyteller_web/src/memory_cache/model_token_to_info_cache.rs rename to crates/service/web/storyteller_web/src/state/memory_cache/model_token_to_info_cache.rs diff --git a/crates/service/web/storyteller_web/src/state/mod.rs b/crates/service/web/storyteller_web/src/state/mod.rs index e387fb76b9..6b6f809010 100644 --- a/crates/service/web/storyteller_web/src/state/mod.rs +++ b/crates/service/web/storyteller_web/src/state/mod.rs @@ -1 +1,2 @@ +pub mod memory_cache; pub mod server_state; \ No newline at end of file diff --git a/crates/service/web/storyteller_web/src/state/server_state.rs b/crates/service/web/storyteller_web/src/state/server_state.rs index c8b5225044..209f1868d2 100644 --- a/crates/service/web/storyteller_web/src/state/server_state.rs +++ b/crates/service/web/storyteller_web/src/state/server_state.rs @@ -28,7 +28,7 @@ use crate::http_server::endpoints::stats::result_transformer::CacheableQueueStat use crate::http_server::endpoints::tts::list_tts_models::TtsModelRecordForResponse; use crate::http_server::endpoints::voice_conversion::models::list_voice_conversion_models::VoiceConversionModel; use crate::http_server::web_utils::redis_rate_limiter::RedisRateLimiter; -use crate::memory_cache::model_token_to_info_cache::ModelTokenToInfoCache; +use crate::state::memory_cache::model_token_to_info_cache::ModelTokenToInfoCache; use crate::StaticApiTokenSet; use crate::threads::db_health_checker_thread::db_health_check_status::HealthCheckStatus; use crate::util::encrypted_sort_id::SortKeyCrypto; diff --git a/crates/service/web/storyteller_web/src/threads/poll_model_token_info_thread.rs b/crates/service/web/storyteller_web/src/threads/poll_model_token_info_thread.rs index 724e6e5988..48085ae4e0 100644 --- a/crates/service/web/storyteller_web/src/threads/poll_model_token_info_thread.rs +++ b/crates/service/web/storyteller_web/src/threads/poll_model_token_info_thread.rs @@ -11,7 +11,7 @@ use errors::AnyhowResult; use mysql_queries::queries::model_weights::model_weight_info_lite::list_model_weight_info_lite::list_model_weight_info_lite; use mysql_queries::queries::voice_conversion::model_info_lite::list_voice_conversion_model_info_lite::list_voice_conversion_model_info_lite; -use crate::memory_cache::model_token_to_info_cache::{ModelInfoForInferenceJob, ModelTokenToInfoCache}; +use crate::state::memory_cache::model_token_to_info_cache::{ModelInfoForInferenceJob, ModelTokenToInfoCache}; pub async fn poll_model_token_info_thread( model_token_info_cache: ModelTokenToInfoCache,