Fix poolmanager sets 0 timeout for function specialization (#1439)

This commit is contained in:
Ta-Ching Chen
2019-11-26 19:22:49 +08:00
committed by GitHub
parent e38baeec36
commit 7e8e968013
7 changed files with 229 additions and 111 deletions
+11 -3
View File
@@ -9,9 +9,9 @@ import (
"strings"
"time"
"go.uber.org/zap"
"github.com/pkg/errors"
"go.opencensus.io/plugin/ochttp"
"go.uber.org/zap"
"golang.org/x/net/context/ctxhttp"
ferror "github.com/fission/fission/pkg/error"
@@ -91,12 +91,20 @@ func sendRequest(logger *zap.Logger, ctx context.Context, httpClient *http.Clien
if err != nil {
logger.Error("error reading response body", zap.Error(err))
}
resp.Body.Close()
defer resp.Body.Close()
return body, err
}
err = ferror.MakeErrorFromHTTP(resp)
}
// skip retry and return directly due to context deadline exceeded
if err == context.DeadlineExceeded {
msg := "error specializing function pod, either increase the specialization timeout for function or check function pod log would help."
err = errors.Wrap(err, msg)
logger.Error(msg, zap.Error(err), zap.String("url", url))
return nil, err
}
if i < maxRetries-1 {
time.Sleep(50 * time.Duration(2*i) * time.Millisecond)
logger.Error("error specializing/fetching/uploading package, retrying", zap.Error(err), zap.String("url", url))