Improve the callback handling with proper client sessions
CrsiX opened this issue · comments
b08e26d introduced a fix that replaced the class-wide (and therefore application-wide) aiohttp
client session with a per-call client session. Even though it works, it's no good style to open a new session for every aspect, as outlined in the docs:
Don’t create a session per request. Most likely you need a session per application which performs all requests altogether.
This has been addressed in the new event posting mechanism using a notifier thread with its own thread-wide aiohttp
client session.
Note that strictly speaking, this client session isn't thread-wide since it's a class variable, but it's intended as such and therefore should only be used in the notifier thread to avoid conflicts due to multiple different async event loops in different threads.