Merge "Check for RetryRequest in MultipleException types"
This commit is contained in:
commit
70d2fc8cc1
@ -39,7 +39,7 @@ MAX_RETRIES = 10
|
||||
|
||||
def is_retriable(e):
|
||||
if _is_nested_instance(e, (db_exc.DBDeadlock, exc.StaleDataError,
|
||||
db_exc.DBDuplicateEntry)):
|
||||
db_exc.DBDuplicateEntry, db_exc.RetryRequest)):
|
||||
return True
|
||||
# looking savepoints mangled by deadlocks. see bug/1590298 for details.
|
||||
return _is_nested_instance(e, db_exc.DBError) and '1305' in str(e)
|
||||
@ -51,7 +51,6 @@ retry_db_errors = oslo_db_api.wrap_db_retry(
|
||||
max_retries=MAX_RETRIES,
|
||||
retry_interval=0.1,
|
||||
inc_retry_interval=True,
|
||||
retry_on_request=True,
|
||||
exception_checker=is_retriable
|
||||
)
|
||||
|
||||
|
@ -69,6 +69,11 @@ class TestDeadLockDecorator(base.BaseTestCase):
|
||||
e = exc.StaleDataError()
|
||||
self.assertIsNone(self._decorated_function(1, e))
|
||||
|
||||
def test_multi_exception_contains_retry(self):
|
||||
e = exceptions.MultipleExceptions(
|
||||
[ValueError(), db_exc.RetryRequest(TypeError())])
|
||||
self.assertIsNone(self._decorated_function(1, e))
|
||||
|
||||
def test_multi_exception_contains_deadlock(self):
|
||||
e = exceptions.MultipleExceptions([ValueError(), db_exc.DBDeadlock()])
|
||||
self.assertIsNone(self._decorated_function(1, e))
|
||||
|
Loading…
x
Reference in New Issue
Block a user