@@ -24,7 +24,7 @@ When using a list of servers, the servers are selected by round-robin::
24
24
25
25
>>> invalid_host = "invalid_host:9999"
26
26
>>> even_more_invalid_host = "even_more_invalid_host:9999"
27
- >>> http_client = HttpClient([crate_host, invalid_host, even_more_invalid_host])
27
+ >>> http_client = HttpClient([crate_host, invalid_host, even_more_invalid_host], timeout=0.3 )
28
28
>>> http_client._get_server()
29
29
'http://127.0.0.1:44209'
30
30
@@ -36,17 +36,18 @@ When using a list of servers, the servers are selected by round-robin::
36
36
37
37
Servers with connection errors will be removed from the active server list::
38
38
39
- >>> http_client = HttpClient([invalid_host, even_more_invalid_host, crate_host])
39
+ >>> http_client = HttpClient([invalid_host, even_more_invalid_host, crate_host], timeout=0.3 )
40
40
>>> result = http_client.sql('select name from locations')
41
41
>>> http_client._active_servers
42
42
['http://127.0.0.1:44209']
43
43
44
44
Inactive servers will be re-added after a given time interval.
45
- To validate this, set the interval very short and sleep for that interval ::
45
+ To validate this, set the interval and timeout very short and sleep after the first request ::
46
46
47
47
>>> http_client.retry_interval = 1
48
- >>> import time; time.sleep(1)
49
48
>>> result = http_client.sql('select name from locations')
49
+ >>> import time; time.sleep(1)
50
+ >>> server = http_client._get_server()
50
51
>>> http_client._active_servers
51
52
['http://invalid_host:9999',
52
53
'http://even_more_invalid_host:9999',
@@ -55,7 +56,7 @@ To validate this, set the interval very short and sleep for that interval::
55
56
If no active servers are available and the retry interval is not reached, just use the oldest
56
57
inactive one::
57
58
58
- >>> http_client = HttpClient([invalid_host, even_more_invalid_host, crate_host])
59
+ >>> http_client = HttpClient([invalid_host, even_more_invalid_host, crate_host], timeout=0.3 )
59
60
>>> result = http_client.sql('select name from locations')
60
61
>>> http_client._active_servers = []
61
62
>>> http_client._get_server()
0 commit comments