fix: avoid potential race

pull/24376/head
Edd Robinson 2021-07-19 14:02:29 +01:00
parent a852dce450
commit 2d6a23f7c3
1 changed files with 3 additions and 2 deletions

View File

@ -530,12 +530,13 @@ where
// Clear out completed tasks
let mut completed_compactions = 0;
self.trackers.retain(|x| {
if x.is_complete() && matches!(x.metadata(), ChunkLifecycleAction::Compacting) {
let completed = x.is_complete();
if completed && matches!(x.metadata(), ChunkLifecycleAction::Compacting) {
// free up slot for another compaction
completed_compactions += 1;
}
!x.is_complete()
!completed
});
// update active compactions