Retry querying package info when "not found" (#1540)

In some cases, creating a package and querying the package info
immediately the Kubernetes API server will return "not found"
error. So retry the query again after some time.
This commit is contained in:
Ta-Ching Chen
2020-02-20 22:20:43 +08:00
committed by GitHub
parent 03ce1e27c7
commit e0dc7f2f81
+9
View File
@@ -555,6 +555,15 @@ func (fetcher *Fetcher) getPkgInformation(req FunctionFetchRequest) (pkg *fv1.Pa
return pkg, nil
}
if i < maxRetries-1 {
// In some cases, creating a package and querying the package info
// immediately, the Kubernetes API server will return "not found"
// error. So retry the query again after some time.
if k8serr.IsNotFound(err) {
time.Sleep(50 * time.Duration(i+1) * time.Millisecond)
continue
}
// All outbound requests are blocked if istio is enabled at the first seconds.
// So if an error is a "connection refused" or "dial" error, wait for a while
// before retrying so that envoy proxy will start to serve requests.