mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Fix #249 -- Blacklist some exceptions for celeries error reporting
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
|
||||
from celery import Celery
|
||||
from celery.utils.mail import ErrorMail
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pretix.settings")
|
||||
|
||||
@@ -8,5 +9,21 @@ from django.conf import settings
|
||||
|
||||
app = Celery('pretix')
|
||||
|
||||
|
||||
class MyErrorMail(ErrorMail):
|
||||
|
||||
def should_send(self, context, exc):
|
||||
from pretix.base.services.orders import OrderError
|
||||
from pretix.base.services.cart import CartError
|
||||
|
||||
blacklist = (OrderError, CartError)
|
||||
return not isinstance(exc, blacklist)
|
||||
|
||||
|
||||
app.config_from_object('django.conf:settings')
|
||||
app.conf.CELERY_ANNOTATIONS = {
|
||||
'*': {
|
||||
'ErrorMail': MyErrorMail,
|
||||
}
|
||||
}
|
||||
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
|
||||
|
||||
Reference in New Issue
Block a user