minor: refactoring ewmaUpdate to decoratorEwmaUpdate
Vladimir Bauer
3 years ago
| 246 | 246 | select { |
| 247 | 247 | case b.operateState <- func(s *bState) { |
| 248 | 248 | if n := current - s.current; n > 0 { |
| 249 | s.ewmaUpdate(n, iterDur) | |
| 249 | s.decoratorEwmaUpdate(n, iterDur) | |
| 250 | 250 | } |
| 251 | 251 | s.current = current |
| 252 | 252 | if s.triggerComplete && s.current >= s.total { |
| 305 | 305 | } |
| 306 | 306 | select { |
| 307 | 307 | case b.operateState <- func(s *bState) { |
| 308 | s.ewmaUpdate(n, iterDur) | |
| 308 | s.decoratorEwmaUpdate(n, iterDur) | |
| 309 | 309 | s.current += n |
| 310 | 310 | if s.triggerComplete && s.current >= s.total { |
| 311 | 311 | s.current = s.total |
| 587 | 587 | return table |
| 588 | 588 | } |
| 589 | 589 | |
| 590 | func (s bState) ewmaUpdate(n int64, dur time.Duration) { | |
| 590 | func (s bState) decoratorEwmaUpdate(n int64, dur time.Duration) { | |
| 591 | 591 | var wg sync.WaitGroup |
| 592 | 592 | for i := 0; i < len(s.ewmaDecorators); i++ { |
| 593 | 593 | switch d := s.ewmaDecorators[i]; i { |