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

interrupt

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler collects all services it handles interrupts for.

func NewInterruptHandler

func NewInterruptHandler(logger logr.Logger, services ...Service) *Handler

NewInterruptHandler return a new interrupt handler for the given services.

func (*Handler) ListenAndGracefulShutdown

func (h *Handler) ListenAndGracefulShutdown() error

ListenAndGracefulShutdown monitors services for interrupts. If received, it starts a graceful shutdown of all the services it monitors. If the deadline for the graceful shutdown is reached, it will terminate all processes with os.Exit(1).

type Service

type Service interface {
	Start(ctx context.Context) error
	Stop()
}

Service defines a service which can start and stop itself.

Jump to

Keyboard shortcuts

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