fn: sigterm graceful shutdown handling (#557)

This commit is contained in:
Tolga Ceylan
2017-12-01 16:56:17 -08:00
committed by Reed Allman
parent 51343ff06a
commit dd88ec5d4e

View File

@@ -12,6 +12,7 @@ import (
"path" "path"
"strconv" "strconv"
"strings" "strings"
"syscall"
"github.com/fnproject/fn/api" "github.com/fnproject/fn/api"
"github.com/fnproject/fn/api/agent" "github.com/fnproject/fn/api/agent"
@@ -292,7 +293,7 @@ func extractFields(c *gin.Context) logrus.Fields {
} }
func (s *Server) Start(ctx context.Context) { func (s *Server) Start(ctx context.Context) {
newctx, cancel := contextWithSignal(ctx, os.Interrupt) newctx, cancel := contextWithSignal(ctx, os.Interrupt, syscall.SIGTERM)
s.startGears(newctx, cancel) s.startGears(newctx, cancel)
} }