You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe it's a better approach (having background workers and further email changes in mind), to create an email backend for celery instead of creating a base-class for all types of async dispatching types.
classCeleryEmailBackend(BaseEmailBackend):
""" Add the email messages batched to a celery task to send the messages trough another backend """defsend_messages(self, email_messages, queue=None):
queue=queueorEMAIL_BACKEND_CELERY_QUEUEemail_messages= [jsonpickle.encode(x) forxinemail_messages]
task_email_backend_celery_send_messages.apply_async(queue=queue, args=[email_messages])
returnlen(email_messages)
Maybe it's a better approach (having background workers and further email changes in mind), to create an email backend for celery instead of creating a base-class for all types of async dispatching types.
Thx to @baskoopmans for these code snippets.
The text was updated successfully, but these errors were encountered: