Documentation
¶
Overview ¶
graceful demonstrates signal-driven single-app graceful shutdown.
This is the drain-oriented shutdown path for one gogo App:
- SIGINT / SIGTERM stops accepting new connections
- accepted requests are allowed to finish naturally
- the context deadline force-closes active connections if they hang
- resources are closed after Run returns
Run with:
CGO_ENABLED=1 go run -tags gogo ./examples/graceful curl http://127.0.0.1:3006/health curl http://127.0.0.1:3006/slow
While /slow is running, press Ctrl+C in the server terminal. The request should finish before the process exits. RunMultiCore has a different group-level shutdown model: MultiCoreHandle.Shutdown calls each worker's immediate Shutdown and does not currently expose this graceful drain.
Click to show internal directories.
Click to hide internal directories.