Skip to content

Commit

Permalink
Fix nil-pointer when no scaling config for function
Browse files Browse the repository at this point in the history
Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
welteki authored and alexellis committed Sep 6, 2022
1 parent 32fa36d commit 835be0f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,13 @@ Features detected:

scalingDown := 0
for _, fn := range functions {
scalingConfigured := fn.Scaling != nil

if fn.Scaling.GetZero() == "true" {
if scalingConfigured && fn.Scaling.GetZero() == "true" {
scalingDown++
}

if fn.Scaling.GetZeroDuration() != "<not set>" {
if scalingConfigured && fn.Scaling.GetZeroDuration() != "<not set>" {
dur, err := time.ParseDuration(fn.Scaling.GetZeroDuration())
if err == nil && dur < time.Minute*5 {
fmt.Printf("⚠️ %s scales down after %.2f minutes, this may be too soon, 5 minutes or higher is recommended\n", fn.Name, dur.Minutes())
Expand Down

0 comments on commit 835be0f

Please sign in to comment.