File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments