fn: user friendly timeout handling changes (#1021)

* fn: user friendly timeout handling changes

Timeout setting in routes now means "maximum amount
of time a function can run in a container".

Total wait time for a given http request is now expected
to be handled by the client. As long as the client waits,
the LB, runner or agents will search for resources to
schedule it.
This commit is contained in:
Tolga Ceylan
2018-06-01 13:18:13 -07:00
committed by GitHub
parent ffefcf5773
commit a57907eed0
15 changed files with 105 additions and 138 deletions

View File

@@ -136,6 +136,8 @@ func (s *TestHarness) Cleanup() {
for app, _ := range s.createdApps {
safeDeleteApp(ctx, s.Client, app)
}
s.Cancel()
}
func EnvAsHeader(req *http.Request, selectedEnv []string) {
@@ -151,7 +153,7 @@ func EnvAsHeader(req *http.Request, selectedEnv []string) {
}
}
func CallFN(u string, content io.Reader, output io.Writer, method string, env []string) (*http.Response, error) {
func CallFN(ctx context.Context, u string, content io.Reader, output io.Writer, method string, env []string) (*http.Response, error) {
if method == "" {
if content == nil {
method = "GET"
@@ -164,8 +166,8 @@ func CallFN(u string, content io.Reader, output io.Writer, method string, env []
if err != nil {
return nil, fmt.Errorf("error running route: %s", err)
}
req.Header.Set("Content-Type", "application/json")
req = req.WithContext(ctx)
if len(env) > 0 {
EnvAsHeader(req, env)