From c19392aa2e8722647abe299f807590ed33a6edca Mon Sep 17 00:00:00 2001 From: nicholaslyang Date: Tue, 7 May 2024 11:05:40 -0600 Subject: [PATCH] PR feedback --- crates/turborepo-lib/src/package_changes_watcher.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/turborepo-lib/src/package_changes_watcher.rs b/crates/turborepo-lib/src/package_changes_watcher.rs index c5874da764bf1..17c722f5110b0 100644 --- a/crates/turborepo-lib/src/package_changes_watcher.rs +++ b/crates/turborepo-lib/src/package_changes_watcher.rs @@ -237,13 +237,16 @@ impl Subscriber { loop { interval.tick().await; + let changed_files = { + let changed_files = self.changed_files.lock().await; + if changed_files.borrow().is_empty() { + continue; + } - let changed_files = self.changed_files.lock().await; - if changed_files.borrow().is_empty() { - continue; - } + changed_files.take() + }; - let ChangedFiles::Some(trie) = changed_files.take() else { + let ChangedFiles::Some(trie) = changed_files else { let _ = self .package_change_events_tx .send(PackageChangeEvent::Rediscover);