graceful

package
v0.64.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: MIT Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Closer

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

Closer handles shutdown of servers and connections

func (*Closer) DetectShutdown

func (cc *Closer) DetectShutdown(log logrus.FieldLogger) func()

DetectShutdown asynchronously waits for a shutdown signal and then shuts down gracefully Returns a function to trigger a shutdown from the outside, like cancelling a context

func (*Closer) Register

func (cc *Closer) Register(name string, shut Shutdownable, timeout time.Duration)

Register inserts a target to shutdown gracefully

type Shutdownable

type Shutdownable interface {
	Shutdown(context.Context) error
}

Shutdownable is a target that can be closed gracefully

Jump to

Keyboard shortcuts

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