api: use sane default in wrap_db_retry()

The current defaults do not make much sense: having max_retries set to 0
completely avoid any retry, which is the whole point of that wrapper.

This patch moves the correct default values from the DBAPI object to the
wrap_db_retry() function itself.

Change-Id: I89c2bd09e69b8b77b716573eb8b889c01f9d0f54
This commit is contained in:
Julien Danjou
2016-05-18 16:27:34 +02:00
parent 9904a1acd7
commit 8e3b356680
2 changed files with 12 additions and 14 deletions

View File

@@ -207,9 +207,9 @@ class DBRetryRequestCase(DBAPITestCase):
some_method()
def test_retry_wrapper_reaches_limit(self):
max_retries = 10
max_retries = 2
@api.wrap_db_retry(max_retries=10)
@api.wrap_db_retry(max_retries=max_retries)
def some_method(res):
res['result'] += 1
raise exception.RetryRequest(ValueError())