File tree 2 files changed +6
-6
lines changed
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ import (
14
14
15
15
// Client is a client for verifying the config version.
16
16
type Client struct {
17
- client * http.Client
17
+ client * http.Client
18
+ maxRetries int
18
19
}
19
20
20
21
// NewClient returns a new client pointed at the config version socket.
@@ -27,6 +28,7 @@ func NewClient() *Client {
27
28
},
28
29
},
29
30
},
31
+ maxRetries : 160 ,
30
32
}
31
33
}
32
34
@@ -57,10 +59,8 @@ func (c *Client) GetConfigVersion() (int, error) {
57
59
// WaitForCorrectVersion calls the config version endpoint until it gets the expectedVersion,
58
60
// which ensures that a new worker process has been started for that config version.
59
61
func (c * Client ) WaitForCorrectVersion (expectedVersion int ) error {
60
- // This value needs tuning.
61
- maxRetries := 160
62
62
sleep := 25 * time .Millisecond
63
- for i := 1 ; i <= maxRetries ; i ++ {
63
+ for i := 1 ; i <= c . maxRetries ; i ++ {
64
64
time .Sleep (sleep )
65
65
66
66
version , err := c .GetConfigVersion ()
Original file line number Diff line number Diff line change @@ -27,9 +27,9 @@ func getTestHTTPClient() *http.Client {
27
27
}
28
28
29
29
func TestVerifyClient (t * testing.T ) {
30
-
31
30
c := Client {
32
- client : getTestHTTPClient (),
31
+ client : getTestHTTPClient (),
32
+ maxRetries : 1 ,
33
33
}
34
34
35
35
configVersion , err := c .GetConfigVersion ()
You can’t perform that action at this time.
0 commit comments