@@ -13,7 +13,7 @@ const DefaultMaxConcurrency = 20
1313
1414type GradientOpts func (* GradientController )
1515
16- func WithRttTolerance (rttt float64 ) GradientOpts {
16+ func WithRTTTolerance (rttt float64 ) GradientOpts {
1717 return func (g * GradientController ) {
1818 g .rttTolerance = rttt
1919 }
@@ -129,9 +129,9 @@ type GradientController struct {
129129 // Variables that are modified by the control loop.
130130 //
131131 // TODO: Refactor the update method out into a separate type to avoid these variables bloating this type.
132- resetRttCounter uint
133- resetNoLoadRtt bool
134- noLoadRtt time.Duration
132+ resetRTTCounter uint
133+ resetNoLoadRTT bool
134+ noLoadRTT time.Duration
135135
136136 // The following variables are instantiated at start.
137137 quitChan chan struct {}
@@ -147,8 +147,8 @@ func (c *GradientController) Start() {
147147 defer c .wg .Done ()
148148
149149 c .pool .Incr (c .initial )
150- c .resetRttCounter = c .nextResetCounter ()
151- c .resetNoLoadRtt = true
150+ c .resetRTTCounter = c .nextResetCounter ()
151+ c .resetNoLoadRTT = true
152152
153153 for {
154154 select {
@@ -175,22 +175,22 @@ func (c *GradientController) update(r Execution) uint {
175175 currLimit := c .pool .WantedN ()
176176 queueSize := c .queueSize (currLimit )
177177
178- c .resetRttCounter --
179- if c .resetRttCounter <= 0 {
180- c .resetRttCounter = c .nextResetCounter ()
181- c .resetNoLoadRtt = true
178+ c .resetRTTCounter --
179+ if c .resetRTTCounter <= 0 {
180+ c .resetRTTCounter = c .nextResetCounter ()
181+ c .resetNoLoadRTT = true
182182 return queueSize
183183 }
184184
185- if c .resetNoLoadRtt || c .noLoadRtt > r .Latency {
186- c .noLoadRtt = r .Latency
187- c .resetNoLoadRtt = false
185+ if c .resetNoLoadRTT || c .noLoadRTT > r .Latency {
186+ c .noLoadRTT = r .Latency
187+ c .resetNoLoadRTT = false
188188 }
189189
190190 // TODO: Remove this line and make this configurable to be logged or not.
191- log .Println ("Reported latency:" , r .Latency , "NoLoadRtt :" , c .noLoadRtt )
191+ log .Println ("Reported latency:" , r .Latency , "NoLoadRTT :" , c .noLoadRTT )
192192
193- gradient := maxf (0.5 , minf (1.0 , c .rttTolerance * float64 (c .noLoadRtt )/ float64 (r .Latency )))
193+ gradient := maxf (0.5 , minf (1.0 , c .rttTolerance * float64 (c .noLoadRTT )/ float64 (r .Latency )))
194194
195195 fcurrLimit := float64 (currLimit )
196196 var newLimit float64
0 commit comments