Open emil14 opened 1 month ago
// graceful shutdown for runtime
ctx, cancel := context.WithCancel(context.Background())
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
go func() {
<-sigChan
cancel()
}()
When we click
ctrl+c
we terminate the neva process without handling it. What we probably should do is to close the context to make sure func-runner is gracefully terminated. It's possible to imagine a situation where some component (e.g. http get) opens a connection and never frees it after ctrl+c (or other termination signals from the OS)Question is, shouldn't user do these kind of things manually? Why e.g. Go doesn't handle resource freeing automatically?