cic-internal-integration/apps/cic-ussd/cic_ussd/tasks/base.py

28 lines
496 B
Python
Raw Normal View History

# standard imports
# third-party imports
import celery
import sqlalchemy
# local imports
2021-04-07 08:21:15 +02:00
from cic_ussd.error import MetadataStoreError
class CriticalTask(celery.Task):
retry_jitter = True
retry_backoff = True
retry_backoff_max = 8
class CriticalSQLAlchemyTask(CriticalTask):
autoretry_for = (
sqlalchemy.exc.DatabaseError,
sqlalchemy.exc.TimeoutError,
)
2021-04-07 08:21:15 +02:00
class CriticalMetadataTask(CriticalTask):
autoretry_for = (
MetadataStoreError,
)