Browse Source

only set lookup cache when successful

pull/2/head
Chris Lu 11 years ago
parent
commit
a437d77431
  1. 3
      go/operation/lookup.go

3
go/operation/lookup.go

@ -28,8 +28,9 @@ var (
func Lookup(server string, vid string) (ret *LookupResult, err error) {
locations, cache_err := vc.Get(vid)
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)
}
} else {
ret = &LookupResult{VolumeId: vid, Locations: locations}
}

Loading…
Cancel
Save