mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
mount: adjust starting order
avoid possible nil wfs.Server
This commit is contained in:
parent
44f1ba6894
commit
e00443a940
|
@ -246,6 +246,7 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
|
||||||
glog.V(0).Infof("mounted %s%s to %v", *option.filer, mountRoot, dir)
|
glog.V(0).Infof("mounted %s%s to %v", *option.filer, mountRoot, dir)
|
||||||
server := fs.New(c, nil)
|
server := fs.New(c, nil)
|
||||||
seaweedFileSystem.Server = server
|
seaweedFileSystem.Server = server
|
||||||
|
seaweedFileSystem.StartBackgroundTasks()
|
||||||
err = server.Serve(seaweedFileSystem)
|
err = server.Serve(seaweedFileSystem)
|
||||||
|
|
||||||
// check if the mount process has an error to report
|
// check if the mount process has an error to report
|
||||||
|
|
|
@ -125,8 +125,6 @@ func NewSeaweedFileSystem(option *Option) *WFS {
|
||||||
glog.V(4).Infof("InvalidateEntry %s : %v", filePath, err)
|
glog.V(4).Infof("InvalidateEntry %s : %v", filePath, err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
startTime := time.Now()
|
|
||||||
go meta_cache.SubscribeMetaEvents(wfs.metaCache, wfs.signature, wfs, wfs.option.FilerMountRootPath, startTime.UnixNano())
|
|
||||||
grace.OnInterrupt(func() {
|
grace.OnInterrupt(func() {
|
||||||
wfs.metaCache.Shutdown()
|
wfs.metaCache.Shutdown()
|
||||||
})
|
})
|
||||||
|
@ -141,6 +139,11 @@ func NewSeaweedFileSystem(option *Option) *WFS {
|
||||||
return wfs
|
return wfs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (wfs *WFS) StartBackgroundTasks() {
|
||||||
|
startTime := time.Now()
|
||||||
|
go meta_cache.SubscribeMetaEvents(wfs.metaCache, wfs.signature, wfs, wfs.option.FilerMountRootPath, startTime.UnixNano())
|
||||||
|
}
|
||||||
|
|
||||||
func (wfs *WFS) Root() (fs.Node, error) {
|
func (wfs *WFS) Root() (fs.Node, error) {
|
||||||
return wfs.root, nil
|
return wfs.root, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue