@@ -42,7 +42,7 @@ When using a list of servers, the servers are selected by round-robin:
4242
4343 >>> invalid_host = " invalid_host:9999"
4444 >>> 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 )
4646 >>> http_client._get_server()
4747 'http://127.0.0.1:44209'
4848
@@ -56,17 +56,19 @@ When using a list of servers, the servers are selected by round-robin:
5656
5757Servers with connection errors will be removed from the active server list:
5858
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 )
6060 >>> result = http_client.sql(' select name from locations' )
6161 >>> http_client._active_servers
6262 ['http://127.0.0.1:44209']
6363
6464Inactive 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::
6667
6768 >>> http_client.retry_interval = 1
68- >>> import time; time.sleep(1 )
6969 >>> result = http_client.sql('select name from locations')
70+ >>> import time; time.sleep(1)
71+ >>> server = http_client._get_server()
7072 >>> http_client._active_servers
7173 ['http://invalid_host:9999',
7274 'http://even_more_invalid_host:9999',
@@ -76,7 +78,7 @@ To validate this, set the interval very short and sleep for that interval:
7678If no active servers are available and the retry interval is not reached, just use the oldest
7779inactive one:
7880
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 )
8082 >>> result = http_client.sql(' select name from locations' )
8183 >>> http_client._active_servers = []
8284 >>> http_client._get_server()
0 commit comments