Capture os signals to gracefully shutdown fission components (#2261)
- Currently, fission components don't handle shutdown signals. So we don't get any to do the required cleanup before the fission process exits. Adding signal capture process with cancelling context so that all dependent processes stop working when the process gets term signal. - Set log level to error in otel shutdown function Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -39,7 +39,7 @@ var (
|
||||
readyToServe uint32
|
||||
)
|
||||
|
||||
func Run(logger *zap.Logger) {
|
||||
func Run(ctx context.Context, logger *zap.Logger) {
|
||||
flag.Usage = fetcherUsage
|
||||
collectorEndpoint := flag.String("jaeger-collector-endpoint", "", "")
|
||||
specializeOnStart := flag.Bool("specialize-on-startup", false, "Flag to activate specialize process at pod starup")
|
||||
@@ -62,8 +62,6 @@ func Run(logger *zap.Logger) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
openTracingEnabled := tracing.TracingEnabled(logger)
|
||||
if openTracingEnabled {
|
||||
go func() {
|
||||
|
||||
+3
-1
@@ -20,6 +20,7 @@ import (
|
||||
"github.com/fission/fission/cmd/fetcher/app"
|
||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||
"github.com/fission/fission/pkg/utils/profile"
|
||||
"github.com/fission/fission/pkg/utils/signals"
|
||||
)
|
||||
|
||||
// Usage: fetcher <shared volume path>
|
||||
@@ -29,5 +30,6 @@ func main() {
|
||||
|
||||
profile.ProfileIfEnabled(logger)
|
||||
|
||||
app.Run(logger)
|
||||
ctx := signals.SetupSignalHandlerWithContext(logger)
|
||||
app.Run(ctx, logger)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user