Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GroupRunner ¶
func Group ¶
func Group(runnables ...Runnable) *GroupRunner
Group returns a runnable that concurrently runs all runnables passed in argument.
type PanicError ¶
type PanicError struct {
// contains filtered or unexported fields
}
func (*PanicError) Error ¶
func (e *PanicError) Error() string
func (*PanicError) Unwrap ¶
func (e *PanicError) Unwrap() error
type PeriodicOptions ¶ added in v0.1.0
PeriodicOptions configures the behavior of a Periodic runnable.
type RecoverRunner ¶
type RecoverRunner struct {
// contains filtered or unexported fields
}
type RestartOptions ¶
type RestartOptions struct {
RestartLimit int // Number of restart after which the runnable will not be restarted.
CrashLimit int // Number of crash after which the runnable will not be restarted.
BackoffSleep time.Duration // Time to wait before restarting.
CrashBackoffSleep time.Duration // Time to wait before restarting after a crash
}
RestartOptions configures the behavior of the Restart runnable
type Runnable ¶
Runnable is the contract for anything that runs with a Go context, respects the concellation contract, and expects the caller to handle errors.
func HTTPServer ¶ added in v0.3.0
func HTTPServer(server ServerWithShutdown) Runnable
HTTPServer returns a runnable that runs a ServerWithShutdown (like *http.Server).
func Periodic ¶ added in v0.1.0
func Periodic(opts PeriodicOptions, runnable Runnable) Runnable
Periodic returns a runnable that will periodically run the runnable passed in argument.
func Recover ¶
Recover returns a runnable that recovers when a runnable panics and return an error to represent this panic.
func Restart ¶
func Restart(opts RestartOptions, runnable Runnable) Runnable
Restart returns a runnable that runs a runnable and restarts it when it fails, with some conditions.