mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Use threading.Thread for @background decorator again.
This commit is contained in:
parent
371cd30893
commit
08fec74cff
@ -1,7 +1,7 @@
|
|||||||
from . import socketio
|
|
||||||
from flask import abort, current_app, request
|
from flask import abort, current_app, request
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
from threading import Thread
|
||||||
|
|
||||||
|
|
||||||
def admin_required(f):
|
def admin_required(f):
|
||||||
@ -26,8 +26,8 @@ def background(f):
|
|||||||
@wraps(f)
|
@wraps(f)
|
||||||
def wrapped(*args, **kwargs):
|
def wrapped(*args, **kwargs):
|
||||||
kwargs['app'] = current_app._get_current_object()
|
kwargs['app'] = current_app._get_current_object()
|
||||||
kwargs['current_user'] = current_user._get_current_object()
|
thread = Thread(target=f, args=args, kwargs=kwargs)
|
||||||
thread = socketio.start_background_task(f, *args, **kwargs)
|
thread.start()
|
||||||
return thread
|
return thread
|
||||||
return wrapped
|
return wrapped
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user