graceful

package
v0.0.0-...-4b9205a Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graceful

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

Graceful struct to hold the provided options and dependencies

func New

func New() *Graceful

New initiate graceful using context background.

func NewContext

func NewContext(ctx context.Context, signals ...os.Signal) *Graceful

NewContext initiate graceful with context param. create signal waiting from os signal that will be triggered when some signal is called.

func (*Graceful) RegisterProcess

func (g *Graceful) RegisterProcess(process func() error)

RegisterProcess register running process to background.

func (*Graceful) RegisterShutdownProcess

func (g *Graceful) RegisterShutdownProcess(process func(context.Context) error)

RegisterShutdownProcess register shutdown process that will be called when got some os signal.

func (*Graceful) RegisterShutdownProcessWithTag

func (g *Graceful) RegisterShutdownProcessWithTag(process func(context.Context) error, tag string)

RegisterShutdownProcessWithTag register shutdown process using tag.

func (*Graceful) SetCancelOnError

func (g *Graceful) SetCancelOnError(value bool)

SetCancelOnError set cancel on error value.

func (*Graceful) SetMaxShutdownProcess

func (g *Graceful) SetMaxShutdownProcess(max int)

SetMaxShutdownProcess set max shutdown process value.

func (*Graceful) SetMaxShutdownTime

func (g *Graceful) SetMaxShutdownTime(duration time.Duration)

SetMaxShutdownTime set max shutdown time value.

func (*Graceful) Wait

func (g *Graceful) Wait() error

Wait waiting for os signal send and call shutdown process when got some signal.

Jump to

Keyboard shortcuts

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