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

@ -115,7 +115,7 @@ def sometimes_async_activity_task(activity_json, queue=MEDIUM):
activity_task.apply_async(args=(activity_json,), queue=queue)
@app.task(queue=MEDIUM)
@app.task(queue=MEDIUM, ignore_result=True)
def activity_task(activity_json):
"""do something with this json we think is legit"""
# lets see if the activitypub module can make sense of this json