mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
only set lookup cache when successful
This commit is contained in:
parent
4b7b439be9
commit
a437d77431
|
@ -28,8 +28,9 @@ var (
|
||||||
func Lookup(server string, vid string) (ret *LookupResult, err error) {
|
func Lookup(server string, vid string) (ret *LookupResult, err error) {
|
||||||
locations, cache_err := vc.Get(vid)
|
locations, cache_err := vc.Get(vid)
|
||||||
if cache_err != nil {
|
if cache_err != nil {
|
||||||
ret, err = do_lookup(server, vid)
|
if ret, err = do_lookup(server, vid); err == nil {
|
||||||
vc.Set(vid, ret.Locations, 1*time.Minute)
|
vc.Set(vid, ret.Locations, 1*time.Minute)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ret = &LookupResult{VolumeId: vid, Locations: locations}
|
ret = &LookupResult{VolumeId: vid, Locations: locations}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue