From 3ba47b2563dbfe3f5a711f6331cf2fc5336b4365 Mon Sep 17 00:00:00 2001 From: Andrea Agostini Date: Mon, 15 Jul 2024 17:23:55 +0200 Subject: [PATCH] Fixed TTL expiration check to trigger file deletion on mounted points --- weed/filer/filer.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/weed/filer/filer.go b/weed/filer/filer.go index 80be0b88e..463dbee00 100644 --- a/weed/filer/filer.go +++ b/weed/filer/filer.go @@ -334,7 +334,10 @@ 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.DeleteOneEntry(ctx, entry) + err = f.doDeleteEntryMetaAndData(ctx, entry, false, false, nil) + if err != nil { + return nil, err + } return nil, filer_pb.ErrNotFound } } @@ -350,7 +353,10 @@ func (f *Filer) doListDirectoryEntries(ctx context.Context, p util.FullPath, sta default: if entry.TtlSec > 0 { if entry.Crtime.Add(time.Duration(entry.TtlSec) * time.Second).Before(time.Now()) { - f.Store.DeleteOneEntry(ctx, entry) + err = f.doDeleteEntryMetaAndData(ctx, entry, false, false, nil) + if err != nil { + return false + } expiredCount++ return true }