You've already forked AstralRinth
forked from didirus/AstralRinth
Debug pin macro (#118)
* debug pin macro * Added debug pinning macro * working on windows * removed remaining box pins
This commit is contained in:
@@ -38,6 +38,9 @@ impl Children {
|
||||
// Runs the command in process, inserts a child process to keep track of, and returns a reference to the container struct MinecraftChild
|
||||
// The threads for stdout and stderr are spawned here
|
||||
// Unlike a Hashmap's 'insert', this directly returns the reference to the MinecraftChild rather than any previously stored MinecraftChild that may exist
|
||||
|
||||
#[tracing::instrument(skip(self))]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn insert_process(
|
||||
&mut self,
|
||||
uuid: Uuid,
|
||||
@@ -110,6 +113,8 @@ impl Children {
|
||||
// Spawns a new child process and inserts it into the hashmap
|
||||
// Also, as the process ends, it spawns the follow-up process if it exists
|
||||
// By convention, ExitStatus is last command's exit status, and we exit on the first non-zero exit status
|
||||
#[tracing::instrument]
|
||||
#[theseus_macros::debug_pin]
|
||||
async fn sequential_process_manager(
|
||||
uuid: Uuid,
|
||||
post_command: Option<Command>,
|
||||
|
||||
@@ -54,6 +54,8 @@ impl Metadata {
|
||||
}
|
||||
|
||||
// Attempt to fetch metadata and store in sled DB
|
||||
#[tracing::instrument]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn init(
|
||||
dirs: &DirectoryInfo,
|
||||
io_semaphore: &IoSemaphore,
|
||||
|
||||
@@ -82,6 +82,8 @@ pub struct State {
|
||||
|
||||
impl State {
|
||||
/// Get the current launcher state, initializing it if needed
|
||||
#[tracing::instrument]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn get() -> crate::Result<Arc<Self>> {
|
||||
LAUNCHER_STATE
|
||||
.get_or_try_init(|| {
|
||||
@@ -166,37 +168,35 @@ impl State {
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
#[theseus_macros::debug_pin]
|
||||
/// Synchronize in-memory state with persistent state
|
||||
pub async fn sync() -> crate::Result<()> {
|
||||
Box::pin(async move {
|
||||
let state = Self::get().await?;
|
||||
let sync_settings = async {
|
||||
let state = Arc::clone(&state);
|
||||
let state = Self::get().await?;
|
||||
let sync_settings = async {
|
||||
let state = Arc::clone(&state);
|
||||
|
||||
tokio::spawn(async move {
|
||||
let reader = state.settings.read().await;
|
||||
reader.sync(&state.directories.settings_file()).await?;
|
||||
Ok::<_, crate::Error>(())
|
||||
})
|
||||
.await?
|
||||
};
|
||||
tokio::spawn(async move {
|
||||
let reader = state.settings.read().await;
|
||||
reader.sync(&state.directories.settings_file()).await?;
|
||||
Ok::<_, crate::Error>(())
|
||||
})
|
||||
.await?
|
||||
};
|
||||
|
||||
let sync_profiles = async {
|
||||
let state = Arc::clone(&state);
|
||||
let sync_profiles = async {
|
||||
let state = Arc::clone(&state);
|
||||
|
||||
tokio::spawn(async move {
|
||||
let profiles = state.profiles.read().await;
|
||||
tokio::spawn(async move {
|
||||
let profiles = state.profiles.read().await;
|
||||
|
||||
profiles.sync().await?;
|
||||
Ok::<_, crate::Error>(())
|
||||
})
|
||||
.await?
|
||||
};
|
||||
profiles.sync().await?;
|
||||
Ok::<_, crate::Error>(())
|
||||
})
|
||||
.await?
|
||||
};
|
||||
|
||||
tokio::try_join!(sync_settings, sync_profiles)?;
|
||||
Ok(())
|
||||
})
|
||||
.await
|
||||
tokio::try_join!(sync_settings, sync_profiles)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Reset IO semaphore to default values
|
||||
|
||||
@@ -249,6 +249,8 @@ impl Profile {
|
||||
Ok(files)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(watcher))]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn watch_fs(
|
||||
profile_path: &Path,
|
||||
watcher: &mut Debouncer<RecommendedWatcher>,
|
||||
@@ -285,6 +287,8 @@ impl Profile {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn add_project_version(
|
||||
&self,
|
||||
version_id: String,
|
||||
@@ -330,6 +334,8 @@ impl Profile {
|
||||
Ok((path, version))
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn add_project_bytes(
|
||||
&self,
|
||||
file_name: &str,
|
||||
@@ -398,6 +404,8 @@ impl Profile {
|
||||
Ok(path)
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn toggle_disable_project(
|
||||
&self,
|
||||
path: &Path,
|
||||
@@ -471,6 +479,7 @@ impl Profile {
|
||||
|
||||
impl Profiles {
|
||||
#[tracing::instrument(skip(file_watcher))]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn init(
|
||||
dirs: &DirectoryInfo,
|
||||
file_watcher: &mut Debouncer<RecommendedWatcher>,
|
||||
@@ -501,6 +510,8 @@ impl Profiles {
|
||||
Ok(Self(profiles))
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn update_projects() {
|
||||
let res = async {
|
||||
let state = State::get().await?;
|
||||
@@ -553,6 +564,7 @@ impl Profiles {
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self))]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn insert(&mut self, profile: Profile) -> crate::Result<&Self> {
|
||||
emit_profile(
|
||||
profile.uuid,
|
||||
|
||||
@@ -200,6 +200,8 @@ pub enum ProjectMetadata {
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
#[theseus_macros::debug_pin]
|
||||
async fn read_icon_from_file(
|
||||
icon_path: Option<String>,
|
||||
cache_dir: &Path,
|
||||
@@ -249,6 +251,8 @@ async fn read_icon_from_file(
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn infer_data_from_files(
|
||||
profile: Profile,
|
||||
paths: Vec<PathBuf>,
|
||||
|
||||
@@ -68,6 +68,8 @@ impl Settings {
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn update_java() {
|
||||
let res = async {
|
||||
let state = State::get().await?;
|
||||
|
||||
@@ -20,6 +20,8 @@ pub struct Tags {
|
||||
}
|
||||
|
||||
impl Tags {
|
||||
#[tracing::instrument]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn init(
|
||||
dirs: &DirectoryInfo,
|
||||
io_semaphore: &IoSemaphore,
|
||||
@@ -50,6 +52,8 @@ impl Tags {
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn update() {
|
||||
let res = async {
|
||||
let state = crate::State::get().await?;
|
||||
|
||||
Reference in New Issue
Block a user