File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ pub fn run_ex(
102102 std:: thread:: Builder :: new ( )
103103 . name ( "disk-space-watcher" . into ( ) )
104104 . spawn_scoped ( scope1, || {
105- disk_watcher. run ( ) ;
105+ disk_watcher. run ( workspace ) ;
106106 } )
107107 . unwrap ( ) ;
108108
Original file line number Diff line number Diff line change @@ -347,6 +347,7 @@ impl<'a> Worker<'a> {
347347 for dir in self . build_dir . values ( ) {
348348 dir. lock ( ) . unwrap ( ) . purge ( ) ?;
349349 }
350+
350351 Ok ( ( ) )
351352 }
352353
@@ -379,10 +380,10 @@ impl<'a> DiskSpaceWatcher<'a> {
379380 self . waiter . notify_all ( ) ;
380381 }
381382
382- pub ( super ) fn run ( & self ) {
383+ pub ( super ) fn run ( & self , workspace : & Workspace ) {
383384 let mut should_stop = self . should_stop . lock ( ) . unwrap ( ) ;
384385 while !* should_stop {
385- self . check ( ) ;
386+ self . check ( workspace ) ;
386387 // Wait for either the interval to pass or should_stop to get a
387388 // write. We don't care if we timed out or not, we can double check
388389 // the should_stop regardless.
@@ -394,7 +395,7 @@ impl<'a> DiskSpaceWatcher<'a> {
394395 }
395396 }
396397
397- fn check ( & self ) {
398+ fn check ( & self , workspace : & Workspace ) {
398399 let usage = match crate :: utils:: disk_usage:: DiskUsage :: fetch ( ) {
399400 Ok ( usage) => usage,
400401 Err ( err) => {
@@ -409,6 +410,10 @@ impl<'a> DiskSpaceWatcher<'a> {
409410 for worker in self . workers {
410411 worker. schedule_target_dir_cleanup ( ) ;
411412 }
413+
414+ if let Err ( e) = workspace. purge_all_caches ( ) {
415+ warn ! ( "failed to purge caches: {:?}" , e) ;
416+ }
412417 }
413418 }
414419}
You can’t perform that action at this time.
0 commit comments