mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-05 00:30:04 -04:00
Celery tests
This commit is contained in:
21
app/celery/celery.py
Normal file
21
app/celery/celery.py
Normal file
@@ -0,0 +1,21 @@
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user