aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/filer.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-11-26 11:14:56 -0800
committerChris Lu <chris.lu@gmail.com>2020-11-26 11:14:56 -0800
commit513bcd6e0d3d4a423b4519398e3d1198088f553a (patch)
tree4edb32d556fa45aa7cc9a70d1556a589abe708c2 /weed/filer/filer.go
parent1ae108efcad582a293e47bf6c0ab548a83b284ef (diff)
downloadseaweedfs-513bcd6e0d3d4a423b4519398e3d1198088f553a.tar.xz
seaweedfs-513bcd6e0d3d4a423b4519398e3d1198088f553a.zip
filer: avoid duplicated FindEntry for deletion
Diffstat (limited to 'weed/filer/filer.go')
-rw-r--r--weed/filer/filer.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/weed/filer/filer.go b/weed/filer/filer.go
index 105c8e04f..5510645cd 100644
--- a/weed/filer/filer.go
+++ b/weed/filer/filer.go
@@ -269,7 +269,7 @@ func (f *Filer) FindEntry(ctx context.Context, p util.FullPath) (entry *Entry, e
entry, err = f.Store.FindEntry(ctx, p)
if entry != nil && entry.TtlSec > 0 {
if entry.Crtime.Add(time.Duration(entry.TtlSec) * time.Second).Before(time.Now()) {
- f.Store.DeleteEntry(ctx, p.Child(entry.Name()))
+ f.Store.DeleteOneEntry(ctx, entry)
return nil, filer_pb.ErrNotFound
}
}
@@ -303,7 +303,7 @@ func (f *Filer) doListDirectoryEntries(ctx context.Context, p util.FullPath, sta
lastFileName = entry.Name()
if entry.TtlSec > 0 {
if entry.Crtime.Add(time.Duration(entry.TtlSec) * time.Second).Before(time.Now()) {
- f.Store.DeleteEntry(ctx, p.Child(entry.Name()))
+ f.Store.DeleteOneEntry(ctx, entry)
expiredCount++
continue
}