Throttle on no metrics/error
This commit is contained in:
parent
0b2702bf53
commit
64083e4705
@ -84,6 +84,7 @@ func (this *Throttler) shouldThrottle() (result bool, reason string, reasonHint
|
|||||||
if statusCode != 0 && statusCode != http.StatusOK {
|
if statusCode != 0 && statusCode != http.StatusOK {
|
||||||
return true, this.throttleHttpMessage(int(statusCode)), base.NoThrottleReasonHint
|
return true, this.throttleHttpMessage(int(statusCode)), base.NoThrottleReasonHint
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replication lag throttle
|
// Replication lag throttle
|
||||||
maxLagMillisecondsThrottleThreshold := atomic.LoadInt64(&this.migrationContext.MaxLagMillisecondsThrottleThreshold)
|
maxLagMillisecondsThrottleThreshold := atomic.LoadInt64(&this.migrationContext.MaxLagMillisecondsThrottleThreshold)
|
||||||
lag := atomic.LoadInt64(&this.migrationContext.CurrentLag)
|
lag := atomic.LoadInt64(&this.migrationContext.CurrentLag)
|
||||||
@ -104,7 +105,7 @@ func (this *Throttler) shouldThrottle() (result bool, reason string, reasonHint
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Got here? No metrics indicates we need throttling.
|
// Got here? No metrics indicates we need throttling.
|
||||||
return true, "", base.NoThrottleReasonHint
|
return false, "", base.NoThrottleReasonHint
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseChangelogHeartbeat parses a string timestamp and deduces replication lag
|
// parseChangelogHeartbeat parses a string timestamp and deduces replication lag
|
||||||
@ -288,7 +289,11 @@ func (this *Throttler) collectThrottleHTTPStatus(firstThrottlingCollected chan<-
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
collectFunc()
|
_, err := collectFunc()
|
||||||
|
if err != nil {
|
||||||
|
atomic.StoreInt64(&this.migrationContext.ThrottleHTTPStatusCode, int64(-1))
|
||||||
|
}
|
||||||
|
|
||||||
firstThrottlingCollected <- true
|
firstThrottlingCollected <- true
|
||||||
|
|
||||||
ticker := time.Tick(100 * time.Millisecond)
|
ticker := time.Tick(100 * time.Millisecond)
|
||||||
|
Loading…
Reference in New Issue
Block a user