Skip to content
Myr

Minor docs fixes. (#3988)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Joshua Bronson · committed by GitHub · parent 98fbb6a · Browse files · 1 file+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:docs/async-await.rst+4 added-4 removed
55 unmodified lines
5657If you wish to use background tasks it is best to use a task queue to58trigger background work, rather than spawn tasks in a view59function. With that in mind you can spawn asyncio tasks by serving60Flask with a ASGI server and utilising the asgiref WsgiToAsgi adapter60Flask with an ASGI server and utilising the asgiref WsgiToAsgi adapter61as described in :ref:`asgi`. This works as the adapter creates an62event loop that runs continually.6364
4 unmodified lines
69to the way it is implemented. If you have a mainly async codebase it70would make sense to consider `Quart`_. Quart is a reimplementation of71Flask based on the `ASGI`_ standard instead of WSGI. This allows it to72handle many concurrent requests, long running requests, and websockets73without requiring individual worker processes or threads.73without requiring multiple worker processes or threads.7475It has also already been possible to run Flask with Gevent or Eventlet76to get many of the benefits of async request handling. These libraries77patch low-level Python functions to accomplish this, whereas ``async``/
7 unmodified lines
8586Extensions87----------8889Existing Flask extensions only expect views to be synchronous. If they90provide decorators to add functionality to views, those will probably89Flask extensions predating Flask's async support do not expect async views.90If they provide decorators to add functionality to views, those will probably91not work with async views because they will not await the function or be92awaitable. Other functions they provide will not be awaitable either and93will probably be blocking if called within an async view.94
10 unmodified lines