forked from TrueCloudLab/rclone
cache: always forget parent dir for notifications - for #2117
This commit is contained in:
parent
d45c750f76
commit
e42cee5e02
1 changed files with 17 additions and 17 deletions
14
backend/cache/cache.go
vendored
14
backend/cache/cache.go
vendored
|
@ -535,29 +535,29 @@ func (f *Fs) receiveChangeNotify(forgetPath string, entryType fs.EntryType) {
|
||||||
if entryType == fs.EntryObject {
|
if entryType == fs.EntryObject {
|
||||||
co := NewObject(f, forgetPath)
|
co := NewObject(f, forgetPath)
|
||||||
err := f.cache.GetObject(co)
|
err := f.cache.GetObject(co)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
fs.Debugf(f, "ignoring change notification for non cached entry %v", co)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// expire the entry
|
// expire the entry
|
||||||
co.CacheTs = time.Now().Add(f.fileAge * -1)
|
co.CacheTs = time.Now().Add(f.fileAge * -1)
|
||||||
err = f.cache.AddObject(co)
|
err = f.cache.AddObject(co)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fs.Errorf(forgetPath, "notify: error expiring '%v': %v", co, err)
|
fs.Debugf(forgetPath, "notify: error expiring '%v': %v", co, err)
|
||||||
} else {
|
} else {
|
||||||
fs.Debugf(forgetPath, "notify: expired %v", co)
|
fs.Debugf(forgetPath, "notify: expired %v", co)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fs.Debugf(f, "ignoring change notification for non cached entry %v", co)
|
||||||
|
}
|
||||||
cd = NewDirectory(f, cleanPath(path.Dir(co.Remote())))
|
cd = NewDirectory(f, cleanPath(path.Dir(co.Remote())))
|
||||||
} else {
|
} else {
|
||||||
cd = NewDirectory(f, forgetPath)
|
cd = NewDirectory(f, forgetPath)
|
||||||
|
}
|
||||||
// we expire the dir
|
// we expire the dir
|
||||||
err := f.cache.ExpireDir(cd)
|
err := f.cache.ExpireDir(cd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fs.Errorf(forgetPath, "notify: error expiring '%v': %v", cd, err)
|
fs.Debugf(forgetPath, "notify: error expiring '%v': %v", cd, err)
|
||||||
} else {
|
} else {
|
||||||
fs.Debugf(forgetPath, "notify: expired '%v'", cd)
|
fs.Debugf(forgetPath, "notify: expired '%v'", cd)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
f.notifiedMu.Lock()
|
f.notifiedMu.Lock()
|
||||||
defer f.notifiedMu.Unlock()
|
defer f.notifiedMu.Unlock()
|
||||||
|
|
Loading…
Reference in a new issue