Documentation ¶
Overview ¶
Package grace allows for gracefully waiting for a listener to finish serving it's active requests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotInheriting is returned by Inherits() when we're not inheriting any fds. ErrNotInheriting = errors.New("grace: no inherited listeners") // ErrAlreadyClosed is returned by Listener.Accept() when Close is in progress. ErrAlreadyClosed = errors.New("grace: already closed") )
Functions ¶
func CloseParent ¶
func CloseParent() error
CloseParent starts the close process in the parent. This does not wait for the parent to close and simply sends it the TERM signal.
Types ¶
type Listener ¶
type Listener interface { net.Listener // Will return the underlying file representing this Listener. File() (f *os.File, err error) }
A Listener providing a graceful Close process and can be sent across processes using the underlying File descriptor.
func NewListener ¶
NewListener wraps an existing File listener to provide a graceful Close() process.
type Process ¶
type Process struct { // TermTimeout if set will determine how long we'll wait for listeners when // we're sent the TERM signal. TermTimeout time.Duration }
Process configures the restart process.
func (*Process) CloseParent ¶
CloseParent starts the close process in the parent. This does not wait for the parent to close and simply sends it the TERM signal.
Directories ¶
Path | Synopsis |
---|---|
Command gracedemo implements a demo server showing how to gracefully terminate an HTTP server using grace.
|
Command gracedemo implements a demo server showing how to gracefully terminate an HTTP server using grace. |
Package gracehttp provides easy to use graceful restart functionality for HTTP server.
|
Package gracehttp provides easy to use graceful restart functionality for HTTP server. |
testserver
Command testserver implements a test case.
|
Command testserver implements a test case. |
Click to show internal directories.
Click to hide internal directories.