I have a two-part question.
If my application is single-threaded and synchronous (e.g. a web app
using Gunicorn with sync workers [1]), and occasionally I need to call
functions in a library that requires an event loop, is there any
downside to creating and closing the loop on-the-fly only when I call
the function? In other words, is creating and destroying loops cheap?
Second, if I were to switch to a multi-threaded model (e.g. Gunicorn
with async workers), is my only option to start the loop at the
beginning of the process, and use loop.call_soon_threadsafe()? Or can
I do what I was asking about above and create and close loops
on-the-fly in different threads? Is either approach much more
efficient than the other?
Thanks,
--Chris
[1] http://docs.gunicorn.org/en/latest/design.html#sync- workers
_______________________________________________
Async-sig mailing list
Async-sig@python.org
https://mail.python.org/mailman/listinfo/async-sig
Code of Conduct: https://www.python.org/psf/codeofconduct/