tarantool / tarantool-python

Python client library for Tarantool
https://www.tarantool.io
BSD 2-Clause "Simplified" License
100 stars 48 forks source link

Implement reconnection strategy class #109

Closed kbelyavs closed 5 years ago

kbelyavs commented 6 years ago

Extend base Connection class to support a list of nodes and an optional Strategy parameter to choose next item from this list.

Add built-in reconnect strategy class based on Round-Robin alg. @params:

Return next connection or an error if all URIs are unavailable.

Closes #106

Totktonada commented 6 years ago
$ flake8 tarantool/__init__.py tarantool/mesh_connection.py 
tarantool/__init__.py:53:1: E302 expected 2 blank lines, found 1
tarantool/mesh_connection.py:16:1: E302 expected 2 blank lines, found 1
tarantool/mesh_connection.py:26:1: E302 expected 2 blank lines, found 1
tarantool/mesh_connection.py:38:9: F841 local variable 'addr' is assigned to but never used
tarantool/mesh_connection.py:45:33: E128 continuation line under-indented for visual indent
tarantool/mesh_connection.py:46:33: E128 continuation line under-indented for visual indent
tarantool/mesh_connection.py:47:33: E128 continuation line under-indented for visual indent
Totktonada commented 6 years ago
$ flake8 test/cluster-py/*.py
test/cluster-py/multi.test.py:18:1: E302 expected 2 blank lines, found 1
test/cluster-py/multi.test.py:30:27: E999 SyntaxError: invalid syntax
test/cluster-py/multi.test.py:41:1: E305 expected 2 blank lines after class or function definition, found 1
test/cluster-py/multi.test.py:52:12: E201 whitespace after '['
test/cluster-py/multi.test.py:52:19: E202 whitespace before ']'
test/cluster-py/multi.test.py:66:67: E251 unexpected spaces around keyword / parameter equals
test/cluster-py/multi.test.py:66:69: E251 unexpected spaces around keyword / parameter equals
test/cluster-py/multi.test.py:100:23: E251 unexpected spaces around keyword / parameter equals
test/cluster-py/multi.test.py:100:25: E251 unexpected spaces around keyword / parameter equals
test/cluster-py/multi.test.py:100:45: E251 unexpected spaces around keyword / parameter equals
test/cluster-py/multi.test.py:100:47: E251 unexpected spaces around keyword / parameter equals
Totktonada commented 5 years ago

I'll ok after:

Also I think we can use default server as the first instance in the test (and setup one more).

Please, proceed with that and merge. I don't think I should look into that again.