diff --git a/pkg/handlers/replica_reader.go b/pkg/handlers/replica_reader.go index cd116baf2..8a8adc4db 100644 --- a/pkg/handlers/replica_reader.go +++ b/pkg/handlers/replica_reader.go @@ -27,7 +27,7 @@ const MaxReplicas = 5 // MaxFunctions licensed for OpenFaaS CE is 15 // a license for OpenFaaS Standard is required to increase this limit. -const MaxFunctions = 10 +const MaxFunctions = 15 // MakeReplicaReader reads the amount of replicas for a deployment func MakeReplicaReader(defaultNamespace string, lister v1.DeploymentLister) http.HandlerFunc { @@ -54,8 +54,9 @@ func MakeReplicaReader(defaultNamespace string, lister v1.DeploymentLister) http function, err := getService(lookupNamespace, functionName, lister) if err != nil { - log.Printf("Unable to fetch service: %s %s\n", functionName, namespace) + log.Printf("Unable to fetch service: %s", functionName) w.WriteHeader(http.StatusInternalServerError) + http.Error(w, fmt.Sprintf("Unable to fetch service: %s", functionName), http.StatusInternalServerError) return } @@ -65,13 +66,12 @@ func MakeReplicaReader(defaultNamespace string, lister v1.DeploymentLister) http } d := time.Since(s) - log.Printf("Replicas: %s.%s, (%d/%d) %dms\n", functionName, lookupNamespace, function.AvailableReplicas, function.Replicas, d.Milliseconds()) + log.Printf("Replicas: %s.%s, (%d/%d) %dms", functionName, lookupNamespace, function.AvailableReplicas, function.Replicas, d.Milliseconds()) functionBytes, err := json.Marshal(function) if err != nil { klog.Errorf("Failed to marshal function: %s", err.Error()) - w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte("Failed to marshal function")) + http.Error(w, "Failed to marshal function", http.StatusInternalServerError) return }