Browse Source

Call parent's __call__ method instead of run()

Calling run() directly skips Celery's internal threading stack management:
https://github.com/celery/celery/blob/master/celery/app/task.py#L382
pull/2889/head
Artem Gordinsky 6 years ago committed by GitHub
parent
commit
255773beec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      docs/patterns/celery.rst

2
docs/patterns/celery.rst

@ -49,7 +49,7 @@ This is all that is necessary to properly integrate Celery with Flask::
class ContextTask(celery.Task):
def __call__(self, *args, **kwargs):
with app.app_context():
return self.run(*args, **kwargs)
return super().__call__(*args, **kwargs)
celery.Task = ContextTask
return celery

Loading…
Cancel
Save