Add global health check interval parameter.
The new parameter allows to set a health check interval valid for all backends. Custom values set per provider may override the global one.
This commit is contained in:
parent
ce492895e2
commit
25345427c3
6 changed files with 71 additions and 12 deletions
|
@ -2,6 +2,7 @@ package healthcheck
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"sync"
|
||||
|
@ -12,9 +13,6 @@ import (
|
|||
"github.com/vulcand/oxy/roundrobin"
|
||||
)
|
||||
|
||||
// DefaultInterval is the default health check interval.
|
||||
const DefaultInterval = 30 * time.Second
|
||||
|
||||
var singleton *HealthCheck
|
||||
var once sync.Once
|
||||
|
||||
|
@ -33,6 +31,10 @@ type Options struct {
|
|||
LB LoadBalancer
|
||||
}
|
||||
|
||||
func (opt Options) String() string {
|
||||
return fmt.Sprintf("[Path: %s Interval: %s]", opt.Path, opt.Interval)
|
||||
}
|
||||
|
||||
// BackendHealthCheck HealthCheck configuration for a backend
|
||||
type BackendHealthCheck struct {
|
||||
Options
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue