clean up cache on exit

This commit is contained in:
chrislu 2022-02-16 00:39:21 -08:00
parent d4dc00471a
commit 37e8fce841
2 changed files with 2 additions and 0 deletions

View file

@ -125,6 +125,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
}) })
grace.OnInterrupt(func() { grace.OnInterrupt(func() {
wfs.metaCache.Shutdown() wfs.metaCache.Shutdown()
os.RemoveAll(option.getUniqueCacheDir())
}) })
wfs.root = &Dir{name: wfs.option.FilerMountRootPath, wfs: wfs, id: 1} wfs.root = &Dir{name: wfs.option.FilerMountRootPath, wfs: wfs, id: 1}

View file

@ -99,6 +99,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
}) })
grace.OnInterrupt(func() { grace.OnInterrupt(func() {
wfs.metaCache.Shutdown() wfs.metaCache.Shutdown()
os.RemoveAll(option.getUniqueCacheDir())
}) })
if wfs.option.ConcurrentWriters > 0 { if wfs.option.ConcurrentWriters > 0 {