4 ms·
So can I just start another process with SO_REUSEADDR and gracefully shutdown the old process? The master/worker thing that nginx / gunicorn et al do is pretty
by mattbillenstein 4y ago
So can I just start another process with SO_REUSEADDR and gracefully shutdown the old process?
The master/worker thing that nginx / gunicorn et al do is pretty neat, but relies on signals; so seems pretty messy and error prone to write yourself.
- klodolph 4y agoYou may have to start both processes with SO_REUSEADDR, I don’t remember the exact semantics. People have a healthy skepticism of signals from the C days, but if we’re talking about Go, you’d just call signal.Notify. Any way of signaling your app to shut down works, though. https://pkg.go.dev/os/signal@go1.20.2#Notify https://pkg.go.dev/os/signal@go1.20.2#Notify