periodic

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromHealthCheckSource added in v1.6.7

func FromHealthCheckSource(ctx context.Context, gracePeriod time.Duration, retryInterval time.Duration, source Source, options ...Option) status.HealthCheckSource

FromHealthCheckSource creates a health check source that calls the the provided Source.Checks functions every retryInterval in a goroutine. The goroutine is cancelled if ctx is cancelled. For each check, if gracePeriod elapses without CheckFunc returning HEALTHY, the returned health check source's HealthStatus will return a HealthCheckResult of error.

func NewHealthCheckSource

func NewHealthCheckSource(ctx context.Context, gracePeriod time.Duration, retryInterval time.Duration, checkType health.CheckType, poll func() error, options ...Option) status.HealthCheckSource

NewHealthCheckSource creates a health check source that calls poll every retryInterval in a goroutine. The goroutine is cancelled if ctx is cancelled. If gracePeriod elapses without poll returning nil, the returned health check source will give a health status of error. checkType is the key to be used in the health result returned by the health check source.

Types

type CheckFunc added in v1.6.7

type CheckFunc func(ctx context.Context) *health.HealthCheckResult

type Option added in v1.7.0

type Option interface {
	// contains filtered or unexported methods
}

func WithInitialPoll added in v1.7.0

func WithInitialPoll() Option

WithInitialPoll configures the health check source to poll immediately instead of waiting for the duration of the check's specified retry interval.

type Source added in v1.6.7

type Source struct {
	Checks map[health.CheckType]CheckFunc
}

Jump to

Keyboard shortcuts

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