update async docs

This commit is contained in:
David Lord 2021-04-06 15:31:28 -07:00
parent 61fbae8664
commit dc3e9c0cc3
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
7 changed files with 109 additions and 65 deletions

View file

@ -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)