INNER CODE UNIT · Go

shutdownTimeout

pilinux/gorest · example3/cmd/app/main.go:116

	const shutdownTimeout = 30 * time.Second
	done := make(chan struct{})
	go func() {
		if err := gserver.GracefulShutdown(srv, shutdownTimeout, done, gdb.CloseAllDB); err != nil {
			fmt.Println(err)
		}
	}()

	if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
		fmt.Printf("server error: %v\n", err)
	}
	<-done
	fmt.Println("server shutdown complete")
}

// maxUploadSize reads MAX_UPLOAD_SIZE_MB (in MiB) and returns it in bytes,
// falling back to defaultMaxUploadSize.
func maxUploadSize() int64 {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…