INNER CODE UNIT · Go

shutdownGracefullyOnCancel

otterize/network-mapper · src/mapper/cmd/main.go:371

func shutdownGracefullyOnCancel(errGroupCtx context.Context, server *echo.Echo) {
	<-errGroupCtx.Done()
	timeoutCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
	defer cancel()

	shutdownErr := server.Shutdown(timeoutCtx)

	if shutdownErr != nil {
		logrus.WithError(shutdownErr).Error("failed to shutdown server")
		_ = server.Close()

	}
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…