Skip to content

Commit 913078c

Browse files
committed
ipn/proxy: allow 10s proxy cooldown time before onNotOK
1 parent 4d05807 commit 913078c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

intra/ipn/proxies.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ const (
143143
responseHeaderTimeout = 60 * time.Second
144144
tzzTimeout = 2 * time.Minute // time between new connections before proxies transition to idle
145145
lastOKThreshold = 10 * time.Minute // time between last OK and now before pinging & un-pinning
146+
ageThreshold = 10 * time.Second // time for proxy to start up
146147
pintimeout = 10 * time.Minute // time to keep a pin
147148
alwaysPin = true // always pin to a proxy no matter the errors
148149
maxFailingPinTrackTTl = 30 * time.Second // max period to track a failing to-be-pinned proxy

intra/ipn/proxy.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -681,13 +681,16 @@ func healthy(p Proxy) error {
681681

682682
stat := p.Router().Stat()
683683
now := now()
684+
age := now - stat.Since
685+
686+
oldEnough := age > ageThreshold.Milliseconds()
684687
lastOK := stat.LastOK
685688
lastOKNeverOK := lastOK <= 0
686689
lastOKBeyondThres := now-lastOK > lastOKThreshold.Milliseconds()
687-
if lastOKNeverOK || lastOKBeyondThres {
690+
if (oldEnough && lastOKNeverOK) || lastOKBeyondThres {
688691
core.Gx("healthy.TNT."+pid, func() { p.onNotOK() }) // not ok for too long
689-
return fmt.Errorf("proxy: %s not ok; lastOK: zz? %t / thres? %t",
690-
pid, lastOKNeverOK, lastOKBeyondThres)
692+
return fmt.Errorf("proxy: %s not ok; age: %s / lastOKNeverOK? %t / lastOKBeyondThres? %t",
693+
pid, core.FmtMillis(age), lastOKNeverOK, lastOKBeyondThres)
691694
} else if now-lastOK > tzzTimeout.Milliseconds() {
692695
core.Gx("healthy.TZZ."+pid, func() { p.Ping() })
693696
} else if p.Status() != TOK {

0 commit comments

Comments
 (0)