mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-16 10:12:32 -05:00
18 lines
483 B
Python
18 lines
483 B
Python
from celery import Celery
|
|
|
|
|
|
class NotifyCelery(Celery):
|
|
|
|
def init_app(self, app):
|
|
super().__init__(app.import_name, broker=app.config['BROKER_URL'])
|
|
self.conf.update(app.config)
|
|
TaskBase = self.Task
|
|
|
|
class ContextTask(TaskBase):
|
|
abstract = True
|
|
|
|
def __call__(self, *args, **kwargs):
|
|
with app.app_context():
|
|
return TaskBase.__call__(self, *args, **kwargs)
|
|
self.Task = ContextTask
|