mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-09 08:06:33 +00:00
godep: update etcd to 3.0.12
This commit is contained in:
4
vendor/github.com/xiang90/probing/prober.go
generated
vendored
4
vendor/github.com/xiang90/probing/prober.go
generated
vendored
@@ -61,7 +61,7 @@ func (p *prober) AddHTTP(id string, probingInterval time.Duration, endpoints []s
|
||||
}
|
||||
resp, err := p.tr.RoundTrip(req)
|
||||
if err != nil {
|
||||
s.recordFailure()
|
||||
s.recordFailure(err)
|
||||
pinned = (pinned + 1) % len(endpoints)
|
||||
continue
|
||||
}
|
||||
@@ -71,7 +71,7 @@ func (p *prober) AddHTTP(id string, probingInterval time.Duration, endpoints []s
|
||||
err = d.Decode(&hh)
|
||||
resp.Body.Close()
|
||||
if err != nil || !hh.OK {
|
||||
s.recordFailure()
|
||||
s.recordFailure(err)
|
||||
pinned = (pinned + 1) % len(endpoints)
|
||||
continue
|
||||
}
|
||||
|
||||
14
vendor/github.com/xiang90/probing/status.go
generated
vendored
14
vendor/github.com/xiang90/probing/status.go
generated
vendored
@@ -14,6 +14,7 @@ type Status interface {
|
||||
Total() int64
|
||||
Loss() int64
|
||||
Health() bool
|
||||
Err() error
|
||||
// Estimated smoothed round trip time
|
||||
SRTT() time.Duration
|
||||
// Estimated clock difference
|
||||
@@ -27,6 +28,7 @@ type status struct {
|
||||
total int64
|
||||
loss int64
|
||||
health bool
|
||||
err error
|
||||
clockdiff time.Duration
|
||||
stopC chan struct{}
|
||||
}
|
||||
@@ -56,6 +58,12 @@ func (s *status) Health() bool {
|
||||
return s.health
|
||||
}
|
||||
|
||||
func (s *status) Err() error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
return s.err
|
||||
}
|
||||
|
||||
func (s *status) ClockDiff() time.Duration {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
@@ -74,15 +82,17 @@ func (s *status) record(rtt time.Duration, when time.Time) {
|
||||
s.health = true
|
||||
s.srtt = time.Duration((1-α)*float64(s.srtt) + α*float64(rtt))
|
||||
s.clockdiff = time.Now().Sub(when) - s.srtt/2
|
||||
s.err = nil
|
||||
}
|
||||
|
||||
func (s *status) recordFailure() {
|
||||
func (s *status) recordFailure(err error) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
s.total++
|
||||
s.health = false
|
||||
s.loss += 1
|
||||
s.err = err
|
||||
}
|
||||
|
||||
func (s *status) reset() {
|
||||
@@ -91,6 +101,8 @@ func (s *status) reset() {
|
||||
|
||||
s.srtt = 0
|
||||
s.total = 0
|
||||
s.loss = 0
|
||||
s.health = false
|
||||
s.clockdiff = 0
|
||||
s.err = nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user