task retries

This commit is contained in:
msramalho
2023-03-10 11:00:02 +00:00
parent 67237b6fd1
commit a400443dc0
2 changed files with 6 additions and 4 deletions

View File

@@ -31,9 +31,8 @@ if (config_bcat_file := os.environ.get("ORCHESTRATION_CONFIG_BELLINGCAT")):
orchestrators = {"bellingcat": None, "default": None}
@celery.task(name="create_archive_task", bind=True)
@celery.task(name="create_archive_task", bind=True, autoretry_for=(Exception,), retry_backoff=True, retry_kwargs={'max_retries': 5})
def create_archive_task(self, url: str, email:str=""):
assert type(url)==str and len(url)>5, f"Invalid URL received: {url}"
orchestrator = choose_orchestrator(email)
result = orchestrator.feed_item(Metadata().set_url(url)).to_json()
with get_db() as session: