Skip to content
Snippets Groups Projects
Verified Commit f842c8d5 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Allow celery_optional to work when bootstrapping

parent 9bae515f
No related branches found
No related tags found
1 merge request!137Generalise notifications and implement SMS notifications
......@@ -114,15 +114,16 @@ def celery_optional(orig: Callable) -> Callable:
and it is executed synchronously.
"""
if hasattr(settings, "CELERY_RESULT_BACKEND"):
from ..celery import app # noqa
task = app.task(orig)
def wrapped(*args, **kwargs):
if hasattr(settings, "CELERY_RESULT_BACKEND"):
from ..celery import app # noqa
task = app.task(orig)
def wrapped(*args, **kwargs):
task.delay(*args, **kwargs)
return wrapped
else:
return orig
else:
orig(*args, **kwargs)
return wrapped
def path_and_rename(instance, filename: str, upload_to: str = "files") -> str:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment