graceful

package
v0.0.0-...-15a0c23 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package graceful provides an orchestrator for graceful shutdown.

Index

Constants

View Source
const DefaultTimeout = 10 * time.Second

DefaultTimeout is a default Timeout to wait for graceful termination.

Variables

This section is empty.

Functions

This section is empty.

Types

type Shutdown

type Shutdown struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

Shutdown manages graceful shutdown.

func (*Shutdown) Close

func (s *Shutdown) Close()

Close invokes shutdown.

func (*Shutdown) EnableGracefulShutdown

func (s *Shutdown) EnableGracefulShutdown()

EnableGracefulShutdown schedules service locator termination SIGTERM or SIGINT.

func (*Shutdown) ShutdownSignal

func (s *Shutdown) ShutdownSignal(subscriber string) (shutdown <-chan struct{}, done chan<- struct{})

ShutdownSignal returns a channel that is closed when service locator is closed or os shutdownSignal is received and a confirmation channel that should be closed once subscriber has finished the shutdown.

func (*Shutdown) Wait

func (s *Shutdown) Wait() error

Wait blocks until shutdown.

func (*Shutdown) WaitToShutdownHTTP

func (s *Shutdown) WaitToShutdownHTTP(server *http.Server, subscriber string) error

WaitToShutdownHTTP synchronously waits for shutdown signal and shutdowns http server.

Jump to

Keyboard shortcuts

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