graceful

command
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL