rename async decorator to asyncfn
This commit is contained in:
parent
af41410b87
commit
a15f7f5145
2 changed files with 3 additions and 3 deletions
|
@ -4,7 +4,7 @@ from flask_login import current_user
|
||||||
from .models import Permission
|
from .models import Permission
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
def async(f):
|
def asyncfn(f):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
thr = Thread(target=f, args=args, kwargs=kwargs)
|
thr = Thread(target=f, args=args, kwargs=kwargs)
|
||||||
thr.start()
|
thr.start()
|
||||||
|
|
|
@ -2,9 +2,9 @@ from threading import Thread
|
||||||
from flask import current_app, render_template
|
from flask import current_app, render_template
|
||||||
from flask_mail import Message
|
from flask_mail import Message
|
||||||
from . import app, mail
|
from . import app, mail
|
||||||
from decorators import async
|
from decorators import asyncfn
|
||||||
|
|
||||||
@async
|
@asyncfn
|
||||||
def send_async_email(app, msg):
|
def send_async_email(app, msg):
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
mail.send(msg)
|
mail.send(msg)
|
||||||
|
|
Loading…
Reference in a new issue