Open tdev-be opened 1 year ago
@tdev-be Thanks, this code works well. Could you make a repo with this already merged? I want to install it that way!
Flask mentions here https://flask.palletsprojects.com/en/2.0.x/async-await/#extensions to use the ensure_sync function for extensions, like this:
def extension(func):
@wraps(func)
def wrapper(*args, **kwargs):
... # Extension logic
return current_app.ensure_sync(func)(*args, **kwargs)
return wrapper
Havent testes it yet, but Im sure it works. I guess this should be used instead, there might be a good reason to not just await the view.
use a coroutine if we are in async mode