Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants