Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasLYang committed Apr 25, 2024
1 parent 13d7250 commit 78f33a5
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions crates/turborepo-lib/src/run/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use crate::{
DaemonConnector, DaemonPaths,
};

#[derive(Clone)]
pub enum ChangedPackages {
All,
Some(HashSet<PackageName>),
Expand Down Expand Up @@ -153,11 +154,9 @@ impl WatchClient {
let run_fut = async {
loop {
changed_pkgs_rx.changed().await?;
let changed_pkgs = changed_pkgs_rx.borrow_and_update();
let changed_pkgs = { changed_pkgs_rx.borrow_and_update().clone() };

self.execute_run(&changed_pkgs).await?;

yield_now().await;
self.execute_run(changed_pkgs).await?;
}
};

Expand Down Expand Up @@ -208,17 +207,16 @@ impl WatchClient {
Ok(())
}

async fn execute_run(&mut self, changed_packages: &ChangedPackages) -> Result<i32, Error> {
async fn execute_run(&mut self, changed_packages: ChangedPackages) -> Result<i32, Error> {
// Should we recover here?
match changed_packages {
ChangedPackages::Some(packages) => {
let packages = packages
.iter()
.into_iter()
.filter(|pkg| {
// If not in the filtered pkgs, ignore
self.run.filtered_pkgs.contains(pkg)
})
.cloned()
.collect();

let mut args = self.base.args().clone();
Expand Down

0 comments on commit 78f33a5

Please sign in to comment.