Make the app arg in @background functions a bit less magical

This commit is contained in:
Patrick Jentsch
2020-04-23 08:35:18 +02:00
parent 83c05d93b0
commit 3a989534cf
4 changed files with 12 additions and 10 deletions

View File

@@ -19,8 +19,8 @@ def background(f):
''' This decorator executes a function in a Thread '''
@wraps(f)
def wrapped(*args, **kwargs):
app = current_app._get_current_object()
thread = Thread(target=f, args=(app, *args), kwargs=kwargs)
kwargs['app'] = current_app._get_current_object()
thread = Thread(target=f, args=args, kwargs=kwargs)
thread.start()
return thread
return wrapped