3 ms·
Shutdown blocks until draining is complete, but ListenAndServe returns immediately when Shutdown is called: https://golang.org/pkg/net/http/#Server.Shutdown htt
by Groxx 8y ago
Shutdown blocks until draining is complete, but ListenAndServe returns immediately when Shutdown is called: https://golang.org/pkg/net/http/#Server.Shutdown https://golang.org/pkg/net/http/#Server.Shutdown
>When Shutdown is called, Serve, ListenAndServe, and ListenAndServeTLS immediately return ErrServerClosed. Make sure the program doesn't exit and waits instead for Shutdown to return.
So no, this writes to the "done" channel essentially immediately once `close(stop)` is called, and ends the process prematurely.