Try to retry InvalidRequestError
from sqlalchemy
not sure if this is a good idea, hopefully can find out in a moment
This commit is contained in:
parent
528c0f9622
commit
4d0223e305
|
@ -27,7 +27,7 @@ Tween Factories
|
||||||
from __future__ import unicode_literals, absolute_import
|
from __future__ import unicode_literals, absolute_import
|
||||||
|
|
||||||
import six
|
import six
|
||||||
from sqlalchemy.exc import OperationalError
|
from sqlalchemy.exc import OperationalError, InvalidRequestError
|
||||||
|
|
||||||
|
|
||||||
def sqlerror_tween_factory(handler, registry):
|
def sqlerror_tween_factory(handler, registry):
|
||||||
|
@ -56,7 +56,7 @@ def sqlerror_tween_factory(handler, registry):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = handler(request)
|
response = handler(request)
|
||||||
except OperationalError as error:
|
except (OperationalError, InvalidRequestError) as error:
|
||||||
|
|
||||||
# if connection is invalid, allow retry
|
# if connection is invalid, allow retry
|
||||||
if error.connection_invalidated:
|
if error.connection_invalidated:
|
||||||
|
|
Loading…
Reference in a new issue