mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 20:16:37 +00:00
Update for scaling edge-case
- as reported on Slack and in issue #931 the gateway scaling code was scaling to zero replicas as a result of the "proportional scaling" added by @Templum's PR. This commit added a failing test which was fixed by adding boundary checking - now if the scaling amount is "0" we keep the current amount of replicas. Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
4a6c6afe94
commit
f5939c9a60
@ -5,12 +5,11 @@ package handlers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"fmt"
|
||||
|
||||
"github.com/openfaas/faas/gateway/requests"
|
||||
)
|
||||
|
||||
@ -119,7 +118,7 @@ func CalculateReplicas(status string, currentReplicas uint64, maxReplicas uint64
|
||||
newReplicas := currentReplicas
|
||||
step := uint64((float64(maxReplicas) / 100) * float64(scalingFactor))
|
||||
|
||||
if status == "firing" {
|
||||
if status == "firing" && step > 0 {
|
||||
if currentReplicas == 1 {
|
||||
newReplicas = step
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user