forked from orbit-oss/flask
update async docs
This commit is contained in:
parent
61fbae8664
commit
dc3e9c0cc3
7 changed files with 109 additions and 65 deletions
|
|
@ -1520,12 +1520,13 @@ class Flask(Scaffold):
|
|||
return False
|
||||
|
||||
def ensure_sync(self, func):
|
||||
"""Ensure that the returned function is sync and calls the async func.
|
||||
"""Ensure that the function is synchronous for WSGI workers.
|
||||
Plain ``def`` functions are returned as-is. ``async def``
|
||||
functions are wrapped to run and wait for the response.
|
||||
|
||||
Override this method to change how the app runs async views.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
|
||||
Override if you wish to change how asynchronous functions are
|
||||
run.
|
||||
"""
|
||||
if iscoroutinefunction(func):
|
||||
return run_async(func)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue