@@ -34,23 +34,23 @@ If no ``server`` argument (or no argument at all) is passed, the default one
3434
3535When using a list of servers, the servers are selected by round-robin:
3636
37- >>> invalid_host = " invalid_host :9999"
38- >>> even_more_invalid_host = " even_more_invalid_host :9999"
39- >>> http_client = HttpClient([crate_host, invalid_host, even_more_invalid_host ], timeout = 0.3 )
37+ >>> invalid_host1 = " 192.0.2.1 :9999"
38+ >>> invalid_host2 = " 192.0.2.2 :9999"
39+ >>> http_client = HttpClient([crate_host, invalid_host1, invalid_host2 ], timeout = 0.3 )
4040 >>> http_client._get_server()
4141 'http://127.0.0.1:44209'
4242
4343 >>> http_client._get_server()
44- 'http://invalid_host :9999'
44+ 'http://192.0.2.1 :9999'
4545
4646 >>> http_client._get_server()
47- 'http://even_more_invalid_host :9999'
47+ 'http://192.0.2.2 :9999'
4848
4949 >>> http_client.close()
5050
5151Servers with connection errors will be removed from the active server list:
5252
53- >>> http_client = HttpClient([invalid_host, even_more_invalid_host , crate_host], timeout = 0.3 )
53+ >>> http_client = HttpClient([invalid_host1, invalid_host2 , crate_host], timeout = 0.3 )
5454 >>> result = http_client.sql(' select name from locations' )
5555 >>> http_client._active_servers
5656 ['http://127.0.0.1:44209']
@@ -64,19 +64,17 @@ sleep after the first request::
6464 >>> import time; time.sleep(1)
6565 >>> server = http_client._get_server()
6666 >>> http_client._active_servers
67- ['http://invalid_host:9999',
68- 'http://even_more_invalid_host:9999',
69- 'http://127.0.0.1:44209']
67+ ['http://127.0.0.1:44209', 'http://192.0.2.2:9999', 'http://192.0.2.1:9999']
7068 >>> http_client.close()
7169
7270If no active servers are available and the retry interval is not reached, just use the oldest
7371inactive one:
7472
75- >>> http_client = HttpClient([invalid_host, even_more_invalid_host , crate_host], timeout = 0.3 )
73+ >>> http_client = HttpClient([invalid_host1, invalid_host2 , crate_host], timeout = 0.3 )
7674 >>> result = http_client.sql(' select name from locations' )
7775 >>> http_client._active_servers = []
7876 >>> http_client._get_server()
79- 'http://invalid_host :9999'
77+ 'http://192.0.2.1 :9999'
8078 >>> http_client.close()
8179
8280SQL Statements
0 commit comments