diff --git a/exchange/tasks.py b/exchange/tasks.py index 861f14b..099e3c8 100644 --- a/exchange/tasks.py +++ b/exchange/tasks.py @@ -1,8 +1,10 @@ import celery - +import backoff +from requests.exceptions import ConnectionError from exchange.conversion import update_rates @celery.task +@backoff.on_exception(backoff.expo, ConnectionError, max_tries=3) def update_task(adapter_class_name=None): update_rates(adapter_class_name=adapter_class_name) diff --git a/setup.py b/setup.py index 1c60f88..c6c52a0 100644 --- a/setup.py +++ b/setup.py @@ -15,6 +15,7 @@ exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), install_requires=[ 'openexchangerates' + 'backoff' ], classifiers=[ 'Development Status :: 5 - Production/Stable',