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(
102
102
std:: thread:: Builder :: new ( )
103
103
. name ( "disk-space-watcher" . into ( ) )
104
104
. spawn_scoped ( scope1, || {
105
- disk_watcher. run ( ) ;
105
+ disk_watcher. run ( workspace ) ;
106
106
} )
107
107
. unwrap ( ) ;
108
108
Original file line number Diff line number Diff line change @@ -347,6 +347,7 @@ impl<'a> Worker<'a> {
347
347
for dir in self . build_dir . values ( ) {
348
348
dir. lock ( ) . unwrap ( ) . purge ( ) ?;
349
349
}
350
+
350
351
Ok ( ( ) )
351
352
}
352
353
@@ -379,10 +380,10 @@ impl<'a> DiskSpaceWatcher<'a> {
379
380
self . waiter . notify_all ( ) ;
380
381
}
381
382
382
- pub ( super ) fn run ( & self ) {
383
+ pub ( super ) fn run ( & self , workspace : & Workspace ) {
383
384
let mut should_stop = self . should_stop . lock ( ) . unwrap ( ) ;
384
385
while !* should_stop {
385
- self . check ( ) ;
386
+ self . check ( workspace ) ;
386
387
// Wait for either the interval to pass or should_stop to get a
387
388
// write. We don't care if we timed out or not, we can double check
388
389
// the should_stop regardless.
@@ -394,7 +395,7 @@ impl<'a> DiskSpaceWatcher<'a> {
394
395
}
395
396
}
396
397
397
- fn check ( & self ) {
398
+ fn check ( & self , workspace : & Workspace ) {
398
399
let usage = match crate :: utils:: disk_usage:: DiskUsage :: fetch ( ) {
399
400
Ok ( usage) => usage,
400
401
Err ( err) => {
@@ -409,6 +410,10 @@ impl<'a> DiskSpaceWatcher<'a> {
409
410
for worker in self . workers {
410
411
worker. schedule_target_dir_cleanup ( ) ;
411
412
}
413
+
414
+ if let Err ( e) = workspace. purge_all_caches ( ) {
415
+ warn ! ( "failed to purge caches: {:?}" , e) ;
416
+ }
412
417
}
413
418
}
414
419
}
You can’t perform that action at this time.
0 commit comments