shutdown

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package shutdown provides a graceful shutdown mechanism.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GracefulShutdown

func GracefulShutdown(ctx context.Context, opts ...OptionFunc)

GracefulShutdown gracefully shutdown the server. 1. tell the load balancer this node is offline, and stop sending new requests 2. set the healthcheck status to unhealthy 3. stop accepting new HTTP requests and wait for existing HTTP requests to finish 4. flushing any buffered log entries

Types

type OptionFunc

type OptionFunc func(ctx context.Context) error

OptionFunc is a function that can be used to configure a graceful shutdown.

func HTTPServerShutdown

func HTTPServerShutdown(httpServer *http.Server) OptionFunc

HTTPServerShutdown shutdown the HTTP server.

func HandlerShutdown

func HandlerShutdown(handler *turl.Handler) OptionFunc

HandlerShutdown shutdown the handler.

Jump to

Keyboard shortcuts

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