Configurable function level timeout (#1284)

This commit is contained in:
parauliya
2019-09-10 23:28:08 +08:00
committed by Ta-Ching Chen
parent 78026ac573
commit 678a2c7ad8
9 changed files with 71 additions and 11 deletions
+1
View File
@@ -19,6 +19,7 @@ package v1
const (
EXECUTOR_INSTANCEID_LABEL string = "executorInstanceId"
POOLMGR_INSTANCEID_LABEL string = "poolmgrInstanceId"
DEFAULT_FUNCTION_TIMEOUT int = 60
)
const (
+4
View File
@@ -337,6 +337,10 @@ type (
// InvokeStrategy is a set of controls which affect how function executes
InvokeStrategy InvokeStrategy
// FunctionTimeout provides a maximum amount of duration wihtin which a request for a particular function execution should be complete.
// This is optional. If not specified default value will be taken as 60s
FunctionTimeout int `json:"functionTimeout,omitempty"`
}
// InvokeStrategy is a set of controls over how the function executes.
+5
View File
@@ -304,6 +304,11 @@ func (spec FunctionSpec) Validate() error {
result = multierror.Append(result, spec.InvokeStrategy.Validate())
}
// TODO Add below validation warning
/*if spec.FunctionTimeout <= 0 {
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "FunctionTimeout value", spec.FunctionTimeout, "not a valid value. Should always be more than 0"))
}*/
return result.ErrorOrNil()
}