Skip to content

Commit 7bf2e71

Browse files
committed
Restores prewarm API
1 parent 4c728fe commit 7bf2e71

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

internal/api/server.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ import (
44
"context"
55
"errors"
66
"fmt"
7-
"github.com/serverledge-faas/serverledge/internal/metrics"
87
"log"
98
"net/http"
109
"os"
1110
"os/signal"
1211
"time"
1312

13+
"github.com/serverledge-faas/serverledge/internal/metrics"
14+
1415
"github.com/labstack/echo/v4"
1516
"github.com/labstack/echo/v4/middleware"
1617
"github.com/serverledge-faas/serverledge/internal/cache"
@@ -31,6 +32,7 @@ func StartAPIServer(e *echo.Echo) {
3132
e.GET("/function", GetFunctions)
3233
e.GET("/poll/:reqId", PollAsyncResult)
3334
e.GET("/status", GetServerStatus)
35+
e.POST("/prewarm", PrewarmFunction)
3436

3537
if config.GetBool(config.METRICS_ENABLED, false) {
3638
e.GET("/metrics", func(c echo.Context) error {

internal/cli/cli.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,11 @@ func ReadSourcesAsTar(srcPath string) ([]byte, error) {
392392
}
393393

394394
func deleteFunction(cmd *cobra.Command, args []string) {
395+
if len(funcName) < 1 {
396+
fmt.Println("Missing function name for deletion.")
397+
showHelpAndExit(cmd)
398+
}
399+
395400
request := function.Function{Name: funcName}
396401
requestBody, err := json.Marshal(request)
397402
if err != nil {

0 commit comments

Comments
 (0)