2021-02-24 08:21:14 +01:00
|
|
|
# import
|
|
|
|
import requests
|
|
|
|
|
2021-02-23 11:10:06 +01:00
|
|
|
# external imports
|
|
|
|
import celery
|
|
|
|
import sqlalchemy
|
|
|
|
|
|
|
|
|
2021-02-24 08:21:14 +01:00
|
|
|
class CriticalTask(celery.Task):
|
|
|
|
retry_jitter = True
|
|
|
|
retry_backoff = True
|
|
|
|
retry_backoff_max = 8
|
|
|
|
|
|
|
|
|
|
|
|
class CriticalSQLAlchemyTask(CriticalTask):
|
2021-02-23 11:10:06 +01:00
|
|
|
autoretry_for = (
|
|
|
|
sqlalchemy.exc.DatabaseError,
|
|
|
|
sqlalchemy.exc.TimeoutError,
|
|
|
|
)
|
2021-02-24 08:21:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class CriticalWeb3Task(CriticalTask):
|
|
|
|
autoretry_for = (
|
|
|
|
requests.exceptions.ConnectionError,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class CriticalSQLAlchemyAndWeb3Task(CriticalTask):
|
|
|
|
autoretry_for = (
|
|
|
|
sqlalchemy.exc.DatabaseError,
|
|
|
|
sqlalchemy.exc.TimeoutError,
|
|
|
|
requests.exceptions.ConnectionError,
|
|
|
|
)
|