Skip to content

Commit 8c2131e

Browse files
Skn0ttbiruwon
andcommitted
feat: support function timeout property
Co-Authored-By: Antonio Rodríguez <[email protected]>
1 parent 809b829 commit 8c2131e

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

go/models/function_config.go

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/porcelain/deploy.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -822,14 +822,15 @@ func bundleFromManifest(ctx context.Context, manifestFile *os.File, observer Dep
822822
}
823823
}
824824

825-
hasConfig := function.DisplayName != "" || function.Generator != "" || len(routes) > 0 || len(function.BuildData) > 0 || function.Priority != 0 || function.TrafficRules != nil
825+
hasConfig := function.DisplayName != "" || function.Generator != "" || len(routes) > 0 || len(function.BuildData) > 0 || function.Priority != 0 || function.TrafficRules != nil || function.Timeout != 0
826826
if hasConfig {
827827
cfg := models.FunctionConfig{
828828
DisplayName: function.DisplayName,
829829
Generator: function.Generator,
830830
Routes: routes,
831831
BuildData: function.BuildData,
832832
Priority: int64(function.Priority),
833+
Timeout: int64(function.Timeout),
833834
}
834835

835836
if function.TrafficRules != nil {

go/porcelain/deploy_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ func TestBundleWithManifest(t *testing.T) {
646646
"mainFile": "/some/path/hello-js-function-test.js",
647647
"displayName": "Hello Javascript Function",
648648
"generator": "@netlify/[email protected]",
649+
"timeout": 60,
649650
"buildData": { "runtimeAPIVersion": 2 },
650651
"name": "hello-js-function-test",
651652
"schedule": "* * * * *",
@@ -703,6 +704,7 @@ func TestBundleWithManifest(t *testing.T) {
703704
assert.Equal(t, 1, len(functionsConfig))
704705
assert.Equal(t, "Hello Javascript Function", helloJSConfig.DisplayName)
705706
assert.Equal(t, "@netlify/[email protected]", helloJSConfig.Generator)
707+
assert.Equal(t, int64(60), helloJSConfig.Timeout)
706708
assert.EqualValues(t, 2, helloJSConfig.BuildData.(map[string]interface{})["runtimeAPIVersion"])
707709

708710
assert.Equal(t, "/products", helloJSConfig.Routes[0].Pattern)

go/porcelain/functions_manifest.go

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type functionsManifestEntry struct {
1717
Schedule string `json:"schedule"`
1818
DisplayName string `json:"displayName"`
1919
Generator string `json:"generator"`
20+
Timeout int `json:"timeout"`
2021
BuildData map[string]interface{} `json:"buildData"`
2122
InvocationMode string `json:"invocationMode"`
2223
Routes []functionRoute `json:"routes"`

swagger.yml

+2
Original file line numberDiff line numberDiff line change
@@ -3859,6 +3859,8 @@ definitions:
38593859
type: string
38603860
generator:
38613861
type: string
3862+
timeout:
3863+
type: integer
38623864
build_data:
38633865
type: object
38643866
routes:

0 commit comments

Comments
 (0)