I have a web app built on a Python 3.5+ async framework (apistar, sanic, etc). The app makes various IO calls - to a database, Redis, etc - which are also async.
Some docs recommend using an additional event loop:
import asyncio import peewee from peewee_async import Manager, PostgresqlDatabase loop = asyncio.new_event_loop() # Note: custom loop! database = PostgresqlDatabase('test') objects = Manager(database, loop=loop) It's my understanding that await statements allow the event loop to context switch whenever it hits IO, so additional event loops seem completely unnecessary.
What is the benefit of using an additional event loop, and when should additional loops be used?