return the not found error
This commit is contained in:
parent
1890ec7044
commit
e7104d609a
12
selector/cache/cache.go
vendored
12
selector/cache/cache.go
vendored
@ -119,10 +119,20 @@ func (c *cacheSelector) get(service string) ([]*registry.Service, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// expired entry so get service
|
// expired entry so get service
|
||||||
if services, err := get(service); err == nil {
|
services, err := get(service)
|
||||||
|
|
||||||
|
// no error then return error
|
||||||
|
if err == nil {
|
||||||
return services, nil
|
return services, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// not found error then return
|
||||||
|
if err == registry.ErrNotFound {
|
||||||
|
return nil, selector.ErrNotFound
|
||||||
|
}
|
||||||
|
|
||||||
|
// other error
|
||||||
|
|
||||||
// return expired cache as last resort
|
// return expired cache as last resort
|
||||||
return c.cp(services), nil
|
return c.cp(services), nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user