gracehttp

package
v0.0.0-...-82e5f6b Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2015 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package gracehttp provides easy to use graceful restart functionality for HTTP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(pidfile string, servers ...*http.Server) error

Serve will serve the given http.Servers and will monitor for signals allowing for graceful termination (SIGTERM) or restart (SIGUSR2).

Types

type App

type App struct {
	Servers []*http.Server

	Pidfile string
	// contains filtered or unexported fields
}

An App contains one or more servers and associated configuration.

func (*App) DeletePidfile

func (a *App) DeletePidfile() error

func (*App) Listen

func (a *App) Listen() (bool, error)

Listen will inherit or create new listeners. Returns a bool indicating if we inherited listeners. This return value is useful in order to decide if we should instruct the parent process to terminate.

func (*App) Serve

func (a *App) Serve()

Serve the configured servers, but do not block. You must call Wait at some point to ensure correctly waiting for graceful termination.

func (*App) Wait

func (a *App) Wait() error

Wait for the serving goroutines to finish.

func (*App) WriteParentPidfile

func (a *App) WriteParentPidfile(ppid int) error

func (*App) WritePidfile

func (a *App) WritePidfile() error

Directories

Path Synopsis
Command testserver implements a test case.
Command testserver implements a test case.

Jump to

Keyboard shortcuts

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