Skip to content

Commit

Permalink
Fix file cache deletion race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
foodprocessor committed Sep 20, 2024
1 parent 28fcc00 commit e13e48e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion component/file_cache/lru_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,13 @@ func (p *lruPolicy) asyncCacheValid() {
for {
select {
case name := <-p.validateChan:
p.cacheValidate(name)
// validateChan only gets names that are already cached
// if the file is not in the map anymore, then it was deleted,
// which means calling cacheValidate now would be a bug
_, found := p.nodeMap.Load(name)
if found {
p.cacheValidate(name)
}

case <-p.closeSignalValidate:
return
Expand Down

0 comments on commit e13e48e

Please sign in to comment.