Help us shape the future of Go! Take the 2026 Go Developer Survey

cleanup

package
v1.0.80 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GracefulShutdown

func GracefulShutdown(ctx context.Context, timeout time.Duration, ops []NamedOperation) <-chan struct{}

GracefulShutdown waits for a termination syscall, then runs ops in the order given.

Types

type CleanupOperation

type CleanupOperation func(ctx context.Context) error

CleanupOperation is a clean up function on shutting down

type NamedOperation added in v1.0.79

type NamedOperation struct {
	Name string
	Op   CleanupOperation
}

NamedOperation is one shutdown step. Order matters, so the caller supplies a slice: these used to run concurrently off a map, which let the gRPC server stop while the services still had work in flight.

Jump to

Keyboard shortcuts

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