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:
parent
00666c4f52
commit
9cbff312a5
12 changed files with 34 additions and 34 deletions
|
@ -420,7 +420,7 @@ def save_and_cleanup(image, instance=None):
|
|||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
@app.task(queue=LOW)
|
||||
@app.task(queue=LOW, ignore_result=True)
|
||||
def generate_site_preview_image_task():
|
||||
"""generate preview_image for the website"""
|
||||
if not settings.ENABLE_PREVIEW_IMAGES:
|
||||
|
@ -445,7 +445,7 @@ def generate_site_preview_image_task():
|
|||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
@app.task(queue=LOW)
|
||||
@app.task(queue=LOW, ignore_result=True)
|
||||
def generate_edition_preview_image_task(book_id):
|
||||
"""generate preview_image for a book"""
|
||||
if not settings.ENABLE_PREVIEW_IMAGES:
|
||||
|
@ -470,7 +470,7 @@ def generate_edition_preview_image_task(book_id):
|
|||
save_and_cleanup(image, instance=book)
|
||||
|
||||
|
||||
@app.task(queue=LOW)
|
||||
@app.task(queue=LOW, ignore_result=True)
|
||||
def generate_user_preview_image_task(user_id):
|
||||
"""generate preview_image for a user"""
|
||||
if not settings.ENABLE_PREVIEW_IMAGES:
|
||||
|
@ -496,7 +496,7 @@ def generate_user_preview_image_task(user_id):
|
|||
save_and_cleanup(image, instance=user)
|
||||
|
||||
|
||||
@app.task(queue=LOW)
|
||||
@app.task(queue=LOW, ignore_result=True)
|
||||
def remove_user_preview_image_task(user_id):
|
||||
"""remove preview_image for a user"""
|
||||
if not settings.ENABLE_PREVIEW_IMAGES:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue