From 08fec74cffb2a0f07bf5957e141788648b353d22 Mon Sep 17 00:00:00 2001 From: Patrick Jentsch <p.jentsch@uni-bielefeld.de> Date: Wed, 22 Sep 2021 13:50:26 +0200 Subject: [PATCH] Use threading.Thread for @background decorator again. --- app/decorators.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/decorators.py b/app/decorators.py index 98a8cb82..c0183484 100644 --- a/app/decorators.py +++ b/app/decorators.py @@ -1,7 +1,7 @@ -from . import socketio from flask import abort, current_app, request from flask_login import current_user from functools import wraps +from threading import Thread def admin_required(f): @@ -26,8 +26,8 @@ def background(f): @wraps(f) def wrapped(*args, **kwargs): kwargs['app'] = current_app._get_current_object() - kwargs['current_user'] = current_user._get_current_object() - thread = socketio.start_background_task(f, *args, **kwargs) + thread = Thread(target=f, args=args, kwargs=kwargs) + thread.start() return thread return wrapped -- GitLab