graceful

package
v0.54.2 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServeGRPC

func ServeGRPC(ctx context.Context, server *grpc.Server, port int) error

ServeGRPC serves a GRPC server and performs a graceful shutdown if/when ctx is cancelled.

func ServeHTTP

func ServeHTTP(ctx context.Context, server *http.Server, options ServeOptions) error

ServeHTTP serves a HTTP server and performs a graceful shutdown if/when ctx is cancelled.

func WithCancelOnTerminate

func WithCancelOnTerminate(ctx context.Context) context.Context

WithCancelOnTerminate derives a context that is cancelled on SIGINT and SIGTERM signals.

func WithMinimumDuration added in v0.53.0

func WithMinimumDuration(parentCtx context.Context, d time.Duration) (context.Context, context.CancelFunc)

WithMinimumDuration derives a context that delays the parent's cancellation until the provided minimum duration has elapsed. When done with the derived context, call the returned cancel function to clean up associated resources.

Types

type ServeOptions added in v0.42.0

type ServeOptions struct {
	Port     int
	CertPath string
	KeyPath  string
}

Jump to

Keyboard shortcuts

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