Retry when executing take_leader method.

This commit is contained in:
Alexander Kukushkin
2015-09-03 16:53:15 +02:00
parent 2f6399de27
commit 50420771ce
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -211,7 +211,7 @@ class Etcd(AbstractDCS):
@catch_etcd_errors
def take_leader(self):
return self.client.set(self.client_path('/leader'), self._name, self.ttl)
return self.retry(self.client.set, self.client_path('/leader'), self._name, self.ttl)
def attempt_to_acquire_leader(self):
try:
+1 -1
View File
@@ -202,7 +202,7 @@ class TestClient(unittest.TestCase):
self.assertRaises(urllib3.exceptions.TimeoutError, self.client._result_from_response, response)
response.content = 'Exception'
self.assertRaises(etcd.EtcdException, self.client._result_from_response, response)
response.content = '{}'
response.content = b'{}'
self.assertRaises(etcd.EtcdException, self.client._result_from_response, response)
def test__get_machines_cache_from_srv(self):