Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Use on_failure bindings for Celery email tasks that require special handling on failure to send #1357

@eastandwestwind

Description

@eastandwestwind

Problem:

We've recently updated most of our email dispatch calls to use celery tasks (asynchronously)- #1341.

But, some of our dispatch email use cases require special handling upon email failure, which Celery does not surface (regardless of if we call asynchronously or synchronously through Celery).

Because Celery does not surface exceptions outside of a task, we currently don't use celery for these use cases, and instead call our dispatch logic directly. We'd like to be able to use Celery for all email dispatch calls.

Solution:

Celery offers an on_failure binding - https://docs.celeryq.dev/en/stable/userguide/tasks.html#on_failure, where we pass in a function to be executed upon failure / exception.

The specific use cases where we need to specify on_failure binding:

  • request completion
  • email connector and test email connector
  • identity verification code

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions