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 ( // This error is returned by Inherits() when we're not inheriting any fds. ErrNotInheriting = errors.New("no inherited listeners") // This error is returned by Listener.Accept() when Close is in progress. ErrAlreadyClosed = errors.New("already closed") // OnSIGUSR1 is the function called when the server receives a // SIGUSR1 signal. The normal use case for SIGUSR1 is to repon the // log files. OnSIGUSR1 func() // ChildProcessWorkingDirectory defines the working directory to // set for the child process on restart. If this is empty it will // default to os.Getwd to determine it. Default is empty. ChildProcessWorkingDirectory string )
Functions ¶
func CloseParent ¶
func CloseParent() error
Start 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 ¶
Wraps an existing File listener to provide a graceful Close() process.
type Process ¶
type Process struct { }
func (*Process) CloseParent ¶
Start 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 go.grace.
|
Command gracedemo implements a demo server showing how to gracefully terminate an HTTP server using go.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.