Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flask[async] compatibility #72

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Flask[async] compatibility #72

wants to merge 2 commits into from

Conversation

tdev-be
Copy link

@tdev-be tdev-be commented Mar 20, 2023

use a coroutine if we are in async mode

tdev-be added 2 commits March 20, 2023 14:07
use a coroutine if we are in async mode
@Space-Banane
Copy link

@tdev-be Thanks, this code works well.
Could you make a repo with this already merged?
I want to install it that way!

@Guddi8
Copy link

Guddi8 commented Apr 14, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants