diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2020-04-27 23:59:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-27 23:59:13 -0700 |
| commit | 47c4a62c5db8564d036cc96c2f4a097494a2567a (patch) | |
| tree | 2a6eb0dd50a530dfb72496a69715438c9aa15a44 /weed/filesys/wfs.go | |
| parent | 2a7957b4ca83fdb5232d761074e81dce6b99648f (diff) | |
| parent | 6850d28d6b99155dca2da8fa8bbf76124f528fa4 (diff) | |
| download | seaweedfs-47c4a62c5db8564d036cc96c2f4a097494a2567a.tar.xz seaweedfs-47c4a62c5db8564d036cc96c2f4a097494a2567a.zip | |
Merge pull request #1293 from wyxloading/refactor_signal_handler
refactor: move signal handling and pprof to grace package
Diffstat (limited to 'weed/filesys/wfs.go')
| -rw-r--r-- | weed/filesys/wfs.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go index e7d1766b6..33403aaf8 100644 --- a/weed/filesys/wfs.go +++ b/weed/filesys/wfs.go @@ -10,6 +10,7 @@ import ( "sync" "time" + "github.com/chrislusf/seaweedfs/weed/util/grace" "github.com/karlseguin/ccache" "google.golang.org/grpc" @@ -89,18 +90,18 @@ func NewSeaweedFileSystem(option *Option) *WFS { } if option.CacheSizeMB > 0 { wfs.chunkCache = chunk_cache.NewChunkCache(256, option.CacheDir, option.CacheSizeMB) - util.OnInterrupt(func() { + grace.OnInterrupt(func() { wfs.chunkCache.Shutdown() }) } if wfs.option.AsyncMetaDataCaching { wfs.metaCache = meta_cache.NewMetaCache(path.Join(option.CacheDir, "meta")) startTime := time.Now() - if err := meta_cache.InitMetaCache(wfs.metaCache, wfs, wfs.option.FilerMountRootPath); err != nil{ + if err := meta_cache.InitMetaCache(wfs.metaCache, wfs, wfs.option.FilerMountRootPath); err != nil { glog.V(0).Infof("failed to init meta cache: %v", err) } else { go meta_cache.SubscribeMetaEvents(wfs.metaCache, wfs, wfs.option.FilerMountRootPath, startTime.UnixNano()) - util.OnInterrupt(func() { + grace.OnInterrupt(func() { wfs.metaCache.Shutdown() }) } |
