Adopt timers for new tenacity release

A new tenacity release [0] has been made which changes the behaviour
of the "wait_exponential" function [1], effectively halving the
multiplier. This leads to issues in the tests where the functionality
is being tested. To resolve the issue, just double the base multiplier.

This change can be used with the former and the new "wait_exponential"
code. If the older version of "tenacity" library is being used, the
waiting periods will be bigger but won't affect the behaviour. We can
avoid then enforcing the minimum version of this library. This is
desirable because this change was made in a minor release.

[0] https://review.opendev.org/677052
[1] aac4307a0a

Change-Id: Ib9055871623f642a74899de8eb536a05c5365f24
This commit is contained in:
Jens Harbott 2019-08-20 15:11:57 +00:00 committed by Rodolfo Alonso Hernandez
parent 490471ebd3
commit a6451b69ab
3 changed files with 3 additions and 3 deletions

View File

@ -90,7 +90,7 @@ def _ovsdb_retry(fn):
new_fn = tenacity.retry(
reraise=True,
retry=tenacity.retry_if_result(_ovsdb_result_pending),
wait=tenacity.wait_exponential(multiplier=0.01, max=1),
wait=tenacity.wait_exponential(multiplier=0.02, max=1),
stop=tenacity.stop_after_delay(
self.ovsdb_timeout))(fn)
return new_fn(*args, **kwargs)

View File

@ -86,7 +86,7 @@ class OvsIdl(idl.Idl):
super(OvsIdl, self).__init__(self._ovsdb_connection, helper)
self.notify_handler = ovsdb_event.RowEventHandler()
@tenacity.retry(wait=tenacity.wait_exponential(multiplier=0.01),
@tenacity.retry(wait=tenacity.wait_exponential(multiplier=0.02),
stop=tenacity.stop_after_delay(1),
reraise=True)
def _do_get_schema_helper(self, connection):

View File

@ -222,7 +222,7 @@ NAMESPACE = None
@tenacity.retry(
wait=tenacity.wait_exponential(multiplier=0.01),
wait=tenacity.wait_exponential(multiplier=0.02),
retry=tenacity.retry_if_exception(lambda e: e.returncode == 255),
reraise=True
)