1
0
Fork 0

Ignore Celery task results

Since we don't use the results of our Celery tasks (all of them return
None implicitly), it's prudent to set the ignore_result flag, for a
potential performance improvement. See the Celery docs for details [1].

We could do this with the global CELERY_IGNORE_RESULT setting, but it
offers more flexibility if we want to use task results in the future to
set it on a per-task basis.

[1]: https://docs.celeryq.dev/en/stable/userguide/tasks.html#ignore-results-you-don-t-want
This commit is contained in:
Wesley Aptekar-Cassels 2023-03-08 02:12:13 -05:00
parent 00666c4f52
commit 9cbff312a5
12 changed files with 34 additions and 34 deletions

View file

@ -65,7 +65,7 @@ class AutoMod(AdminModel):
created_by = models.ForeignKey("User", on_delete=models.PROTECT)
@app.task(queue=LOW)
@app.task(queue=LOW, ignore_result=True)
def automod_task():
"""Create reports"""
if not AutoMod.objects.exists():