Merge "Expand retry behavior to cover other python-ovs methods"

This commit is contained in:
Zuul 2018-11-20 22:52:22 +00:00 committed by Gerrit Code Review
commit 0249d2df93
1 changed files with 7 additions and 7 deletions

View File

@ -91,18 +91,18 @@ class Connection(object):
def run(self): def run(self):
errors = 0 errors = 0
while self._is_running: while self._is_running:
self.idl.wait(self.poller) # If we fail in an Idl call, we could have missed an update
self.poller.fd_wait(self.txns.alert_fileno, poller.POLLIN)
# TODO(jlibosva): Remove next line once losing connection to ovsdb
# is solved.
self.poller.timer_wait(self.timeout * 1000)
self.poller.block()
# If we fail on a run() call, we could have missed an update
# from the server, leaving us out of sync with ovsdb-server. # from the server, leaving us out of sync with ovsdb-server.
# It is not safe to continue without restarting the connection, # It is not safe to continue without restarting the connection,
# though it is likely that the error is unrecoverable, so only try # though it is likely that the error is unrecoverable, so only try
# a few times before bailing completely. # a few times before bailing completely.
try: try:
self.idl.wait(self.poller)
self.poller.fd_wait(self.txns.alert_fileno, poller.POLLIN)
# TODO(jlibosva): Remove next line once losing connection to
# ovsdb is solved.
self.poller.timer_wait(self.timeout * 1000)
self.poller.block()
self.idl.run() self.idl.run()
except Exception as e: except Exception as e:
# This shouldn't happen, but is possible if there is a bug # This shouldn't happen, but is possible if there is a bug