From 480a2dc2163934831e201fc735e4e5bd5d998472 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Mon, 21 Feb 2022 00:00:01 -0500 Subject: [PATCH] thread refactor --- crates/service/twitch_pubsub_subscriber/src/main.rs | 2 +- .../listen_for_active_obs_sessions_thread.rs | 2 +- .../src/threads/listen_for_active_obs_sessions/mod.rs | 1 + crates/service/twitch_pubsub_subscriber/src/threads/mod.rs | 5 ++--- .../twitch_pubsub_subscriber/src/threads/thread_state/mod.rs | 1 - .../src/threads/twitch_pubsub_user_subscriber/mod.rs | 2 ++ .../subscriber_preferences_cache.rs} | 0 .../twitch_pubsub_user_subscriber_thread.rs | 3 ++- 8 files changed, 9 insertions(+), 7 deletions(-) rename crates/service/twitch_pubsub_subscriber/src/threads/{ => listen_for_active_obs_sessions}/listen_for_active_obs_sessions_thread.rs (96%) create mode 100644 crates/service/twitch_pubsub_subscriber/src/threads/listen_for_active_obs_sessions/mod.rs delete mode 100644 crates/service/twitch_pubsub_subscriber/src/threads/thread_state/mod.rs create mode 100644 crates/service/twitch_pubsub_subscriber/src/threads/twitch_pubsub_user_subscriber/mod.rs rename crates/service/twitch_pubsub_subscriber/src/threads/{thread_state/twitch_pubsub_subscriber_state.rs => twitch_pubsub_user_subscriber/subscriber_preferences_cache.rs} (100%) rename crates/service/twitch_pubsub_subscriber/src/threads/{ => twitch_pubsub_user_subscriber}/twitch_pubsub_user_subscriber_thread.rs (99%) diff --git a/crates/service/twitch_pubsub_subscriber/src/main.rs b/crates/service/twitch_pubsub_subscriber/src/main.rs index 3362a2c49b..eca1f18f65 100644 --- a/crates/service/twitch_pubsub_subscriber/src/main.rs +++ b/crates/service/twitch_pubsub_subscriber/src/main.rs @@ -18,7 +18,7 @@ pub mod util; use config::shared_constants::{DEFAULT_RUST_LOG, DEFAULT_REDIS_DATABASE_1_CONNECTION_STRING, DEFAULT_MYSQL_CONNECTION_STRING}; use container_common::anyhow_result::AnyhowResult; -use crate::threads::listen_for_active_obs_sessions_thread::ListenForActiveObsSessionThread; +use crate::threads::listen_for_active_obs_sessions::listen_for_active_obs_sessions_thread::ListenForActiveObsSessionThread; use crate::twitch::oauth::oauth_token_refresher::OauthTokenRefresher; use crate::twitch::websocket_client::TwitchWebsocketClient; use futures::executor::{ThreadPool, ThreadPoolBuilder}; diff --git a/crates/service/twitch_pubsub_subscriber/src/threads/listen_for_active_obs_sessions_thread.rs b/crates/service/twitch_pubsub_subscriber/src/threads/listen_for_active_obs_sessions/listen_for_active_obs_sessions_thread.rs similarity index 96% rename from crates/service/twitch_pubsub_subscriber/src/threads/listen_for_active_obs_sessions_thread.rs rename to crates/service/twitch_pubsub_subscriber/src/threads/listen_for_active_obs_sessions/listen_for_active_obs_sessions_thread.rs index e3b33de4c2..ea25c146c2 100644 --- a/crates/service/twitch_pubsub_subscriber/src/threads/listen_for_active_obs_sessions_thread.rs +++ b/crates/service/twitch_pubsub_subscriber/src/threads/listen_for_active_obs_sessions/listen_for_active_obs_sessions_thread.rs @@ -1,5 +1,5 @@ use container_common::thread::thread_id::ThreadId; -use crate::threads::twitch_pubsub_user_subscriber_thread::TwitchPubsubUserSubscriberThread; +use crate::threads::twitch_pubsub_user_subscriber::twitch_pubsub_user_subscriber_thread::TwitchPubsubUserSubscriberThread; use crate::twitch::oauth::oauth_token_refresher::OauthTokenRefresher; use log::error; use log::info; diff --git a/crates/service/twitch_pubsub_subscriber/src/threads/listen_for_active_obs_sessions/mod.rs b/crates/service/twitch_pubsub_subscriber/src/threads/listen_for_active_obs_sessions/mod.rs new file mode 100644 index 0000000000..dfaf27e527 --- /dev/null +++ b/crates/service/twitch_pubsub_subscriber/src/threads/listen_for_active_obs_sessions/mod.rs @@ -0,0 +1 @@ +pub mod listen_for_active_obs_sessions_thread; \ No newline at end of file diff --git a/crates/service/twitch_pubsub_subscriber/src/threads/mod.rs b/crates/service/twitch_pubsub_subscriber/src/threads/mod.rs index 43ebea277e..4a9aa6ac56 100644 --- a/crates/service/twitch_pubsub_subscriber/src/threads/mod.rs +++ b/crates/service/twitch_pubsub_subscriber/src/threads/mod.rs @@ -1,3 +1,2 @@ -pub mod listen_for_active_obs_sessions_thread; -pub mod thread_state; -pub mod twitch_pubsub_user_subscriber_thread; \ No newline at end of file +pub mod listen_for_active_obs_sessions; +pub mod twitch_pubsub_user_subscriber; \ No newline at end of file diff --git a/crates/service/twitch_pubsub_subscriber/src/threads/thread_state/mod.rs b/crates/service/twitch_pubsub_subscriber/src/threads/thread_state/mod.rs deleted file mode 100644 index 173ba58045..0000000000 --- a/crates/service/twitch_pubsub_subscriber/src/threads/thread_state/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod twitch_pubsub_subscriber_state; \ No newline at end of file diff --git a/crates/service/twitch_pubsub_subscriber/src/threads/twitch_pubsub_user_subscriber/mod.rs b/crates/service/twitch_pubsub_subscriber/src/threads/twitch_pubsub_user_subscriber/mod.rs new file mode 100644 index 0000000000..abe7108e99 --- /dev/null +++ b/crates/service/twitch_pubsub_subscriber/src/threads/twitch_pubsub_user_subscriber/mod.rs @@ -0,0 +1,2 @@ +pub mod subscriber_preferences_cache; +pub mod twitch_pubsub_user_subscriber_thread; \ No newline at end of file diff --git a/crates/service/twitch_pubsub_subscriber/src/threads/thread_state/twitch_pubsub_subscriber_state.rs b/crates/service/twitch_pubsub_subscriber/src/threads/twitch_pubsub_user_subscriber/subscriber_preferences_cache.rs similarity index 100% rename from crates/service/twitch_pubsub_subscriber/src/threads/thread_state/twitch_pubsub_subscriber_state.rs rename to crates/service/twitch_pubsub_subscriber/src/threads/twitch_pubsub_user_subscriber/subscriber_preferences_cache.rs diff --git a/crates/service/twitch_pubsub_subscriber/src/threads/twitch_pubsub_user_subscriber_thread.rs b/crates/service/twitch_pubsub_subscriber/src/threads/twitch_pubsub_user_subscriber/twitch_pubsub_user_subscriber_thread.rs similarity index 99% rename from crates/service/twitch_pubsub_subscriber/src/threads/twitch_pubsub_user_subscriber_thread.rs rename to crates/service/twitch_pubsub_subscriber/src/threads/twitch_pubsub_user_subscriber/twitch_pubsub_user_subscriber_thread.rs index 7e7b086736..d9f3f8f4e4 100644 --- a/crates/service/twitch_pubsub_subscriber/src/threads/twitch_pubsub_user_subscriber_thread.rs +++ b/crates/service/twitch_pubsub_subscriber/src/threads/twitch_pubsub_user_subscriber/twitch_pubsub_user_subscriber_thread.rs @@ -1,7 +1,8 @@ use anyhow::{anyhow, Error}; use container_common::anyhow_result::AnyhowResult; use container_common::thread::thread_id::ThreadId; -use crate::threads::thread_state::twitch_pubsub_subscriber_state::{TwitchEventRuleLight, TwitchPubsubCachedState}; +use crate::threads::twitch_pubsub_user_subscriber::subscriber_preferences_cache::TwitchEventRuleLight; +use crate::threads::twitch_pubsub_user_subscriber::subscriber_preferences_cache::TwitchPubsubCachedState; use crate::twitch::constants::TWITCH_PING_CADENCE; use crate::twitch::oauth::oauth_token_refresher::OauthTokenRefresher; use crate::twitch::pubsub::build_pubsub_topics_for_user::build_pubsub_topics_for_user;