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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
[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]
pub async fn sync(path: &Path) -> crate::Result<()> {
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) {
profile.sync().await?;
State::sync().await?;
Ok(())
} else {
Err(
crate::ErrorKind::UnmanagedProfileError(path.display().to_string())
.as_error(),
)
}
if let Some(profile) = profiles.0.get_mut(path) {
profile.sync().await?;
Ok(())
} else {
Err(crate::ErrorKind::UnmanagedProfileError(
path.display().to_string(),
)
.as_error())
}
};
State::sync().await?;
result
}
/// Add a project from a version

View File

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

View File

@ -10,8 +10,6 @@ pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# 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 = { 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"] }
thiserror = "1.0"
tokio-stream = { version = "0.1", features = ["fs"] }