serving

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DefaultListenWaitHTTPShutdownTimeout is the time to allow connections to
	// cleanly close. 30 seconds is the GKE preemption time, so we cut it a
	// little shorter.
	DefaultListenWaitHTTPShutdownTimeout = 25 * time.Second
)

Variables

This section is empty.

Functions

func ListenWaitHTTP

func ListenWaitHTTP(ctx context.Context, s *http.Server, opts ...ListenWaitHTTPOption) error

ListenWaitHTTP will run a server and catch the context close but allow existing connections to clean up nicely instead of immediately exiting.

Types

type ListenWaitHTTPOption

type ListenWaitHTTPOption func(opts *ListenWaitHTTPOptions)

func ListenWaitWithHTTPCloserRequireContext

func ListenWaitWithHTTPCloserRequireContext(fn func(ctx context.Context) error) ListenWaitHTTPOption

func ListenWaitWithHTTPCloserWhen

func ListenWaitWithHTTPCloserWhen(fn func(ctx context.Context) error) ListenWaitHTTPOption

func ListenWaitWithHTTPShutdownTimeout

func ListenWaitWithHTTPShutdownTimeout(timeout time.Duration) ListenWaitHTTPOption

func ListenWaitWithTLS

func ListenWaitWithTLS(certificateFile, keyFile string) ListenWaitHTTPOption

type ListenWaitHTTPOptions

type ListenWaitHTTPOptions struct {
	ShutdownTimeout       time.Duration
	CloserWhens           []func(ctx context.Context) error
	CloserRequireContexts []func(ctx context.Context) error
	TLSCertificateFile    string
	TLSKeyFile            string
}

Jump to

Keyboard shortcuts

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