Fix poolmanager sets 0 timeout for function specialization (#1439)
This commit is contained in:
@@ -111,8 +111,17 @@ func (executor *Executor) serveCreateFuncServices() {
|
||||
// still can serve other subsequent requests.
|
||||
|
||||
buffer := 10 // add some buffer time for specialization
|
||||
specializationTimeout := req.function.Spec.InvokeStrategy.ExecutionStrategy.SpecializationTimeout
|
||||
|
||||
// set minimum specialization timeout to avoid illegal input and
|
||||
// compatibility problem when applying old spec file that doesn't
|
||||
// have specialization timeout field.
|
||||
if specializationTimeout < fv1.DefaultSpecializationTimeOut {
|
||||
specializationTimeout = fv1.DefaultSpecializationTimeOut
|
||||
}
|
||||
|
||||
fnSpecializationTimeoutContext, cancel := context.WithTimeout(context.Background(),
|
||||
time.Duration(req.function.Spec.InvokeStrategy.ExecutionStrategy.SpecializationTimeout+buffer)*time.Second)
|
||||
time.Duration(specializationTimeout+buffer)*time.Second)
|
||||
defer cancel()
|
||||
|
||||
fsvc, err := executor.createServiceForFunction(fnSpecializationTimeoutContext, req.function)
|
||||
|
||||
@@ -138,6 +138,9 @@ func (deploy *NewDeploy) GetTypeName() fv1.ExecutorType {
|
||||
}
|
||||
|
||||
func (deploy *NewDeploy) GetFuncSvc(ctx context.Context, fn *fv1.Function) (*fscache.FuncSvc, error) {
|
||||
// TODO: client-go doesn't support to pass in context.
|
||||
// Once it supports context, we should change the signature of method.
|
||||
// https://github.com/kubernetes/kubernetes/issues/46503
|
||||
return deploy.createFunction(fn, false)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user