fix airbrake for celery

This commit is contained in:
Silver Ghost 2022-11-07 12:28:33 +03:00
parent 1ef54495d9
commit d1311b9e64
No known key found for this signature in database

View File

@ -6,12 +6,16 @@ from later42.models.urls import URL
from later42.models.article import Article from later42.models.article import Article
from later42.libs.content import get_content from later42.libs.content import get_content
notifier = pybrake.Notifier( AIRBRAKE_PROJECT_ID = os.getenv('AIRBRAKE_PROJECT_ID', None)
project_id=os.getenv('AIRBRAKE_PROJECT_ID'), AIRBRAKE_PROJECT_KEY = os.getenv('AIRBRAKE_PROJECT_KEY', None)
project_key=os.getenv('AIRBRAKE_PROJECT_KEY'),
environment="celery" if AIRBRAKE_PROJECT_ID is not None and AIRBRAKE_PROJECT_KEY is not None:
) notifier = pybrake.Notifier(
patch_celery(notifier) project_id=AIRBRAKE_PROJECT_ID,
project_key=AIRBRAKE_PROJECT_KEY,
environment="celery"
)
patch_celery(notifier)
@shared_task() @shared_task()