shutdown

package
v0.0.0-...-388d6c9 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 6 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. stop accepting new connections and RPCs and blocks until all the pending RPCs are finished. 5. 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 GRPCServerShutdown

func GRPCServerShutdown(s *grpc.Server) OptionFunc

GRPCServerShutdown shutdown the gRPC server.

func HTTPServerShutdown

func HTTPServerShutdown(httpServer *http.Server) OptionFunc

HTTPServerShutdown shutdown the HTTP server.

func HealthServerShutdown

func HealthServerShutdown(healthServer *health.Server) OptionFunc

HealthServerShutdown shutdown the healthcheck server.

func LogSync

func LogSync() OptionFunc

LogSync flushes any buffered log entries.

func ResolverDeregister

func ResolverDeregister(pairs ...*resolver.Pair) OptionFunc

ResolverDeregister deregister the service from the resolver.

Jump to

Keyboard shortcuts

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