Skip to content

Commit

Permalink
Add allow reconnect for all etcd clients
Browse files Browse the repository at this point in the history
  • Loading branch information
titilambert committed Sep 4, 2017
1 parent c1f9e08 commit 8be9d0a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tuxeatpi_common/etcd_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _connect(self):
# Get sync client receiver
while True:
try:
etcd_client = etcd.Client(self.host, self.port)
etcd_client = etcd.Client(self.host, self.port, allow_reconnect=True)
# Test connection
etcd_client.cluster_version # pylint: disable=W0104
# Save client
Expand All @@ -49,7 +49,7 @@ def _connect(self):
# Get sync client sender
while True:
try:
etcd_sender = etcd.Client(self.host, self.port)
etcd_sender = etcd.Client(self.host, self.port, allow_reconnect=True)
# Test connection
etcd_sender.cluster_version # pylint: disable=W0104
# Save client
Expand All @@ -59,7 +59,7 @@ def _connect(self):
self.logger.warning("Can not connect to etcd server, retrying in 5 seconds")
time.sleep(5)
# Get async etcd client
self.async_client = aio_etcd.Client(self.host, self.port)
self.async_client = aio_etcd.Client(self.host, self.port, allow_reconnect=True)

def read(self, key, recursive=False, wait=False, timeout=60):
"""Sync Etcd read operation"""
Expand Down

0 comments on commit 8be9d0a

Please sign in to comment.