File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -130,14 +130,17 @@ func (r *Runner) waitForIsRunning(
130130) bool {
131131 ctx , cancel := context .WithTimeout (ctx , timeout )
132132 defer cancel ()
133- initialRetry := 5 * time .Millisecond
133+ retryDelay := 5 * time .Millisecond
134134 maxRetry := 1 * time .Second
135135
136+ timer := time .NewTimer (retryDelay )
137+ defer timer .Stop ()
138+
136139 for {
137140 select {
138141 case <- ctx .Done ():
139142 return false
140- case <- time . After ( initialRetry ) :
143+ case <- timer . C :
141144 if server .IsRunning () {
142145 return true
143146 }
@@ -147,8 +150,8 @@ func (r *Runner) waitForIsRunning(
147150 return false
148151 }
149152
150- // Exponentially increase the backoff delay
151- initialRetry = min ( time . Duration ( float64 ( initialRetry ) * 1.5 ), maxRetry )
153+ retryDelay = min ( time . Duration ( float64 ( retryDelay ) * 1.5 ), maxRetry )
154+ timer . Reset ( retryDelay )
152155 }
153156 }
154157}
You can’t perform that action at this time.
0 commit comments