Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit daemon error paths and ensure we are doing everything we can to handle #7334

Merged
merged 6 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
132 changes: 95 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions crates/turborepo-filewatch/src/package_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,27 @@ impl PackageDiscovery for WatchingPackageDiscovery {
package_manager,
})
}

// if the event that either of the dependencies will never resolve,
// this will still return unavailable
async fn discover_packages_blocking(&self) -> Result<DiscoveryResponse, discovery::Error> {
let package_manager = self
.watcher
.wait_for_package_manager()
.await
.map_err(|_| discovery::Error::Unavailable)?;

let workspaces = self
.watcher
.wait_for_package_data()
.await
.map_err(|_| discovery::Error::Unavailable)?;

Ok(DiscoveryResponse {
workspaces,
package_manager,
})
}
}

/// Watches the filesystem for changes to packages and package managers.
Expand Down Expand Up @@ -685,6 +706,10 @@ mod test {
workspaces: self.package_data.lock().unwrap().clone(),
})
}

async fn discover_packages_blocking(&self) -> Result<DiscoveryResponse, discovery::Error> {
self.discover_packages().await
}
}

#[tokio::test]
Expand Down
6 changes: 3 additions & 3 deletions crates/turborepo-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ path-clean = "1.0.1"
petgraph = { workspace = true }
pidlock = { path = "../turborepo-pidlock" }
portable-pty = "0.8.1"
prost = "0.11.6"
prost = "0.12.3"
rand = { workspace = true }
reqwest = { workspace = true, default-features = false, features = ["json"] }
rustc_version_runtime = "0.2.1"
Expand All @@ -84,8 +84,8 @@ tiny-gradient = { workspace = true }
tokio = { workspace = true, features = ["full", "time"] }
tokio-stream = { version = "0.1.12", features = ["net"] }
tokio-util = { version = "0.7.7", features = ["compat"] }
tonic = { version = "0.8.3", features = ["transport"] }
tonic-reflection = { version = "0.6.0", optional = true }
tonic = { version = "0.11.0", features = ["transport"] }
tonic-reflection = { version = "0.11.0", optional = true }
tower = "0.4.13"
turborepo-analytics = { path = "../turborepo-analytics" }
turborepo-auth = { path = "../turborepo-auth" }
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-lib/src/daemon/bump_timeout_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use std::sync::Arc;

use tonic::transport::NamedService;
use tonic::server::NamedService;
use tower::{Layer, Service};

use super::bump_timeout::BumpTimeout;
Expand Down