mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
mount: avoid exception if disk cache is not initialized
related to https://github.com/chrislusf/seaweedfs/issues/2102
This commit is contained in:
parent
615cb24ba6
commit
556cc3a4ca
|
@ -42,6 +42,10 @@ func NewOnDiskCacheLayer(dir, namePrefix string, diskSize int64, segmentCount in
|
|||
|
||||
func (c *OnDiskCacheLayer) setChunk(needleId types.NeedleId, data []byte) {
|
||||
|
||||
if len(c.diskCaches) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
if c.diskCaches[0].fileSize+int64(len(data)) > c.diskCaches[0].sizeLimit {
|
||||
t, resetErr := c.diskCaches[len(c.diskCaches)-1].Reset()
|
||||
if resetErr != nil {
|
||||
|
|
Loading…
Reference in a new issue