@@ -42,7 +42,7 @@ When using a list of servers, the servers are selected by round-robin:
42
42
43
43
>>> invalid_host = " invalid_host:9999"
44
44
>>> even_more_invalid_host = " even_more_invalid_host:9999"
45
- >>> http_client = HttpClient([crate_host, invalid_host, even_more_invalid_host])
45
+ >>> http_client = HttpClient([crate_host, invalid_host, even_more_invalid_host], timeout = 0.3 )
46
46
>>> http_client._get_server()
47
47
'http://127.0.0.1:44209'
48
48
@@ -56,17 +56,19 @@ When using a list of servers, the servers are selected by round-robin:
56
56
57
57
Servers with connection errors will be removed from the active server list:
58
58
59
- >>> 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 )
60
60
>>> result = http_client.sql(' select name from locations' )
61
61
>>> http_client._active_servers
62
62
['http://127.0.0.1:44209']
63
63
64
64
Inactive servers will be re-added after a given time interval.
65
- To validate this, set the interval very short and sleep for that interval:
65
+ To validate this, set the interval and timeout very short, and
66
+ sleep after the first request::
66
67
67
68
>>> http_client.retry_interval = 1
68
- >>> import time; time.sleep(1 )
69
69
>>> result = http_client.sql('select name from locations')
70
+ >>> import time; time.sleep(1)
71
+ >>> server = http_client._get_server()
70
72
>>> http_client._active_servers
71
73
['http://invalid_host:9999',
72
74
'http://even_more_invalid_host:9999',
@@ -76,7 +78,7 @@ To validate this, set the interval very short and sleep for that interval:
76
78
If no active servers are available and the retry interval is not reached, just use the oldest
77
79
inactive one:
78
80
79
- >>> http_client = HttpClient([invalid_host, even_more_invalid_host, crate_host])
81
+ >>> http_client = HttpClient([invalid_host, even_more_invalid_host, crate_host], timeout = 0.3 )
80
82
>>> result = http_client.sql(' select name from locations' )
81
83
>>> http_client._active_servers = []
82
84
>>> http_client._get_server()
0 commit comments