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 @@ -344,6 +344,7 @@ impl<'a> Worker<'a> {
344
344
for dir in self . build_dir . values ( ) {
345
345
dir. lock ( ) . unwrap ( ) . purge ( ) ?;
346
346
}
347
+
347
348
Ok ( ( ) )
348
349
}
349
350
@@ -376,10 +377,10 @@ impl<'a> DiskSpaceWatcher<'a> {
376
377
self . waiter . notify_all ( ) ;
377
378
}
378
379
379
- pub ( super ) fn run ( & self ) {
380
+ pub ( super ) fn run ( & self , workspace : & Workspace ) {
380
381
let mut should_stop = self . should_stop . lock ( ) . unwrap ( ) ;
381
382
while !* should_stop {
382
- self . check ( ) ;
383
+ self . check ( workspace ) ;
383
384
// Wait for either the interval to pass or should_stop to get a
384
385
// write. We don't care if we timed out or not, we can double check
385
386
// the should_stop regardless.
@@ -391,7 +392,7 @@ impl<'a> DiskSpaceWatcher<'a> {
391
392
}
392
393
}
393
394
394
- fn check ( & self ) {
395
+ fn check ( & self , workspace : & Workspace ) {
395
396
let usage = match crate :: utils:: disk_usage:: DiskUsage :: fetch ( ) {
396
397
Ok ( usage) => usage,
397
398
Err ( err) => {
@@ -406,6 +407,10 @@ impl<'a> DiskSpaceWatcher<'a> {
406
407
for worker in self . workers {
407
408
worker. schedule_target_dir_cleanup ( ) ;
408
409
}
410
+
411
+ if let Err ( e) = workspace. purge_all_caches ( ) {
412
+ warn ! ( "failed to purge caches: {:?}" , e) ;
413
+ }
409
414
}
410
415
}
411
416
}
You can’t perform that action at this time.
0 commit comments