Skip to content

Commit e834b54

Browse files
Greg Soltischris-olszewski
Greg Soltis
andauthored
fix(Turborepo): Flag off daemon for package discovery (#7290)
### Description Daemon package watching has some bugs that need to be ironed out. Flag it off for now. ### Testing Instructions Disabled integration test that explicitly checks for the behavior that we are flagging off. Closes TURBO-2265 --------- Co-authored-by: Greg Soltis <Greg Soltis> Co-authored-by: Chris Olszewski <[email protected]>
1 parent 4fe5a9d commit e834b54

File tree

3 files changed

+31
-23
lines changed

3 files changed

+31
-23
lines changed

crates/turborepo-lib/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ rustls-tls = ["turborepo-api-client/rustls-tls", "turbo-updater/rustls-tls"]
1515
http = ["tonic-reflection"]
1616

1717
go-daemon = []
18+
daemon-package-discovery = []
1819

1920
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2021
[dev-dependencies]

crates/turborepo-lib/src/run/mod.rs

+30-23
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ impl Run {
232232
let is_ci_or_not_tty = turborepo_ci::is_ci() || !std::io::stdout().is_terminal();
233233
run_telemetry.track_ci(turborepo_ci::Vendor::get_name());
234234

235+
// Remove allow when daemon is flagged back on
236+
#[allow(unused_mut)]
235237
let mut daemon = match (is_ci_or_not_tty, self.opts.run_opts.daemon) {
236238
(true, None) => {
237239
run_telemetry.track_daemon_init(DaemonInitStatus::Skipped);
@@ -272,33 +274,38 @@ impl Run {
272274
}
273275
};
274276

275-
// if we are forcing the daemon, we don't want to fallback to local discovery
276-
let (fallback, duration) = if let Some(true) = self.opts.run_opts.daemon {
277-
(None, Duration::MAX)
278-
} else {
279-
(
280-
Some(
281-
LocalPackageDiscoveryBuilder::new(
282-
self.base.repo_root.clone(),
283-
None,
284-
Some(root_package_json.clone()),
277+
let mut pkg_dep_graph = {
278+
let builder = PackageGraph::builder(&self.base.repo_root, root_package_json.clone())
279+
.with_single_package_mode(self.opts.run_opts.single_package);
280+
281+
#[cfg(feature = "daemon-package-discovery")]
282+
let builder = {
283+
// if we are forcing the daemon, we don't want to fallback to local discovery
284+
let (fallback, duration) = if let Some(true) = self.opts.run_opts.daemon {
285+
(None, Duration::MAX)
286+
} else {
287+
(
288+
Some(
289+
LocalPackageDiscoveryBuilder::new(
290+
self.base.repo_root.clone(),
291+
None,
292+
Some(root_package_json.clone()),
293+
)
294+
.build()?,
295+
),
296+
Duration::from_millis(10),
285297
)
286-
.build()?,
287-
),
288-
Duration::from_millis(10),
289-
)
290-
};
291-
292-
let mut pkg_dep_graph =
293-
PackageGraph::builder(&self.base.repo_root, root_package_json.clone())
294-
.with_single_package_mode(self.opts.run_opts.single_package)
295-
.with_package_discovery(FallbackPackageDiscovery::new(
298+
};
299+
let fallback_discovery = FallbackPackageDiscovery::new(
296300
daemon.as_mut().map(DaemonPackageDiscovery::new),
297301
fallback,
298302
duration,
299-
))
300-
.build()
301-
.await?;
303+
);
304+
builder.with_package_discovery(fallback_discovery)
305+
};
306+
307+
builder.build().await?
308+
};
302309

303310
repo_telemetry.track_package_manager(pkg_dep_graph.package_manager().to_string());
304311
repo_telemetry.track_size(pkg_dep_graph.len());

0 commit comments

Comments
 (0)