mirror of
https://github.com/chrislusf/seaweedfs
synced 2024-07-03 23:56:41 +02:00
auto create non-existing cache directory
fix https://github.com/chrislusf/seaweedfs/issues/1350
This commit is contained in:
parent
bdbe5ddbe9
commit
bb3e86fbd5
|
@ -89,6 +89,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if option.CacheSizeMB > 0 {
|
if option.CacheSizeMB > 0 {
|
||||||
|
os.MkdirAll(option.CacheDir, 0755)
|
||||||
wfs.chunkCache = chunk_cache.NewChunkCache(256, option.CacheDir, option.CacheSizeMB)
|
wfs.chunkCache = chunk_cache.NewChunkCache(256, option.CacheDir, option.CacheSizeMB)
|
||||||
grace.OnInterrupt(func() {
|
grace.OnInterrupt(func() {
|
||||||
wfs.chunkCache.Shutdown()
|
wfs.chunkCache.Shutdown()
|
||||||
|
|
|
@ -49,6 +49,10 @@ func CheckFile(filename string) (exists, canRead, canWrite bool, modTime time.Ti
|
||||||
exists = false
|
exists = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if err != nil {
|
||||||
|
glog.Errorf("check %s: %v", filename, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
if fi.Mode()&0400 != 0 {
|
if fi.Mode()&0400 != 0 {
|
||||||
canRead = true
|
canRead = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue