shutdown

package
v0.0.0-...-eb33cdb Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Listener

type Listener interface {
	OnShutdown(context.Context) error
}

type ListenerFunc

type ListenerFunc func(context.Context) error

func (ListenerFunc) OnShutdown

func (f ListenerFunc) OnShutdown(ctx context.Context) error

type Shutdown

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

func New

func New(timeout time.Duration, listeners map[string]Listener) *Shutdown

func (*Shutdown) Wait

func (s *Shutdown) Wait() (os.Signal, error)

Wait receive an message that will be printed out to logger before blocking. Wait block the call and wait for SIGINT, SIGTERM or SIGHUP signals. After signal is received, this method will run Listener.OnShutdown in parallel, the operation must complete under specified timeout. If any listeners return an error or operation is timed out this method will call os.Exit(1).

Jump to

Keyboard shortcuts

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