mirror of https://github.com/langgenius/dify.git
add request context to celery
This commit is contained in:
parent
26d12b34ce
commit
ed583f7e4b
|
|
@ -47,7 +47,11 @@ def _get_celery_ssl_options() -> dict[str, Any] | None:
|
|||
def init_app(app: DifyApp) -> Celery:
|
||||
class FlaskTask(Task):
|
||||
def __call__(self, *args: object, **kwargs: object) -> object:
|
||||
from core.logging.context import init_request_context
|
||||
|
||||
with app.app_context():
|
||||
# Initialize logging context for this task (similar to before_request in Flask)
|
||||
init_request_context()
|
||||
return self.run(*args, **kwargs)
|
||||
|
||||
broker_transport_options = {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue