Deadlock fixes (#85)

* fixed deadlock

* added missing files to commit

* clippy & dist
This commit is contained in:
Wyatt Verchere
2023-04-17 16:07:09 -07:00
committed by GitHub
parent 19a4aa6689
commit 63d2785b2f
6 changed files with 22 additions and 16 deletions

View File

@@ -1,3 +1,3 @@
# Windows has stack overflows when calling from Tauri, so we increase compiler size # Windows has stack overflows when calling from Tauri, so we increase compiler size
[target.'cfg(windows)'] [target.'cfg(windows)']
rustflags = ["-C", "link-args=/STACK:4194304"] rustflags = ["-C", "link-args=/STACK:8388608"]

View File

@@ -89,19 +89,23 @@ pub async fn list() -> crate::Result<std::collections::HashMap<PathBuf, Profile>
#[tracing::instrument] #[tracing::instrument]
pub async fn sync(path: &Path) -> crate::Result<()> { pub async fn sync(path: &Path) -> crate::Result<()> {
let state = State::get().await?; let state = State::get().await?;
let mut profiles = state.profiles.write().await; let result = {
let mut profiles: tokio::sync::RwLockWriteGuard<
crate::state::Profiles,
> = state.profiles.write().await;
if let Some(profile) = profiles.0.get_mut(path) { if let Some(profile) = profiles.0.get_mut(path) {
profile.sync().await?; profile.sync().await?;
State::sync().await?; Ok(())
} else {
Ok(()) Err(crate::ErrorKind::UnmanagedProfileError(
} else { path.display().to_string(),
Err( )
crate::ErrorKind::UnmanagedProfileError(path.display().to_string()) .as_error())
.as_error(), }
) };
} State::sync().await?;
result
} }
/// Add a project from a version /// Add a project from a version

View File

@@ -26,6 +26,7 @@ impl DirectoryInfo {
"Could not find valid config dir".to_string(), "Could not find valid config dir".to_string(),
))?; ))?;
dbg!(&config_dir);
fs::create_dir_all(&config_dir).await.map_err(|err| { fs::create_dir_all(&config_dir).await.map_err(|err| {
crate::ErrorKind::FSError(format!( crate::ErrorKind::FSError(format!(
"Error creating Theseus config directory: {err}" "Error creating Theseus config directory: {err}"

View File

@@ -10,8 +10,6 @@ pnpm-debug.log*
lerna-debug.log* lerna-debug.log*
node_modules node_modules
dist
dist-ssr
*.local *.local
# Editor directories and files # Editor directories and files

3
theseus_gui/dist/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
# exclude everything except this file
*
!.gitignore

View File

@@ -19,7 +19,7 @@ theseus = { path = "../../theseus", features = ["tauri"] }
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.2", features = ["protocol-asset", "window-close", "window-create", "dialog"] } tauri = { version = "1.2", features = ["dialog", "protocol-asset", "window-close", "window-create"] }
tokio = { version = "1", features = ["full"] } tokio = { version = "1", features = ["full"] }
thiserror = "1.0" thiserror = "1.0"
tokio-stream = { version = "0.1", features = ["fs"] } tokio-stream = { version = "0.1", features = ["fs"] }