mirror of
https://github.com/traefik/traefik.git
synced 2025-05-14 11:44:40 +00:00
Finish kubernetes throttling refactoring
This commit is contained in:
parent
43af0b051f
commit
1388266102
@ -110,13 +110,16 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.
|
|||||||
}
|
}
|
||||||
|
|
||||||
throttleDuration := time.Duration(p.ThrottleDuration)
|
throttleDuration := time.Duration(p.ThrottleDuration)
|
||||||
eventsChanToRead := throttleEvents(ctxLog, throttleDuration, stop, eventsChan)
|
throttledChan := throttleEvents(ctxLog, throttleDuration, stop, eventsChan)
|
||||||
|
if throttledChan != nil {
|
||||||
|
eventsChan = throttledChan
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-stop:
|
case <-stop:
|
||||||
return nil
|
return nil
|
||||||
case event := <-eventsChanToRead:
|
case event := <-eventsChan:
|
||||||
// Note that event is the *first* event that came in during this
|
// Note that event is the *first* event that came in during this
|
||||||
// throttling interval -- if we're hitting our throttle, we may have
|
// throttling interval -- if we're hitting our throttle, we may have
|
||||||
// dropped events. This is fine, because we don't treat different
|
// dropped events. This is fine, because we don't treat different
|
||||||
|
@ -121,13 +121,16 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.
|
|||||||
}
|
}
|
||||||
|
|
||||||
throttleDuration := time.Duration(p.ThrottleDuration)
|
throttleDuration := time.Duration(p.ThrottleDuration)
|
||||||
eventsChanToRead := throttleEvents(ctxLog, throttleDuration, stop, eventsChan)
|
throttledChan := throttleEvents(ctxLog, throttleDuration, stop, eventsChan)
|
||||||
|
if throttledChan != nil {
|
||||||
|
eventsChan = throttledChan
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-stop:
|
case <-stop:
|
||||||
return nil
|
return nil
|
||||||
case event := <-eventsChanToRead:
|
case event := <-eventsChan:
|
||||||
// Note that event is the *first* event that came in during this
|
// Note that event is the *first* event that came in during this
|
||||||
// throttling interval -- if we're hitting our throttle, we may have
|
// throttling interval -- if we're hitting our throttle, we may have
|
||||||
// dropped events. This is fine, because we don't treat different
|
// dropped events. This is fine, because we don't treat different
|
||||||
|
Loading…
x
Reference in New Issue
Block a user