return the not found error

This commit is contained in:
Asim Aslam 2017-10-28 16:21:32 +01:00
parent 1890ec7044
commit e7104d609a

View File

@ -119,10 +119,20 @@ func (c *cacheSelector) get(service string) ([]*registry.Service, error) {
}
// 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
}
// not found error then return
if err == registry.ErrNotFound {
return nil, selector.ErrNotFound
}
// other error
// return expired cache as last resort
return c.cp(services), nil
}