internal: various cleanup
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I48f7eac2e99d1d2af02fcf237401be096a6a6964
This commit is contained in:
parent
0ca9d5b615
commit
56e1935ead
6 changed files with 33 additions and 48 deletions
|
|
@ -141,12 +141,7 @@ func (p *Prober) RecordFailure(url string) {
|
|||
return
|
||||
}
|
||||
h.ConsecutiveFails++
|
||||
switch {
|
||||
case h.ConsecutiveFails >= 10:
|
||||
h.Status = StatusDown
|
||||
case h.ConsecutiveFails >= 3:
|
||||
h.Status = StatusDegraded
|
||||
}
|
||||
h.Status = computeStatus(h.ConsecutiveFails)
|
||||
if p.persistHealth != nil {
|
||||
u, ema, cf, tq := h.URL, h.EMALatency, h.ConsecutiveFails, h.TotalQueries
|
||||
fn := p.persistHealth
|
||||
|
|
@ -199,9 +194,9 @@ func (p *Prober) ProbeUpstream(url string) {
|
|||
// Skip if URL is not in table. This prevents in-flight probes from
|
||||
// resurrecting removed upstreams (race: RemoveUpstream called while
|
||||
// ProbeUpstream is in flight).
|
||||
p.mu.Lock()
|
||||
p.mu.RLock()
|
||||
_, exists := p.table[url]
|
||||
p.mu.Unlock()
|
||||
p.mu.RUnlock()
|
||||
if !exists {
|
||||
// URL was removed or never added; do not resurrect.
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue