shutdown

package
v1.24.5 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MonitorShutdown

func MonitorShutdown(triggerCh <-chan struct{}, handlers ...ShutdownHandler) <-chan struct{}

MonitorShutdown manages shutdown requests, by watching signals and invoking the supplied handlers in order.

It watches SIGTERM and SIGINT OS signals, as well as the trigger channel. When any of them fire, it calls the supplied handlers in order. If any of them errors, it merely logs the error.

Once the shutdown has completed, it closes the returned channel. The caller can watch this channel

Types

type ShutdownHandler

type ShutdownHandler struct {
	Component string
	StopFunc  StopFunc
}

type StopFunc

type StopFunc func(context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳