Skip to content

Quart: Keep a single ClientSession

Compare
Choose a tag to compare
@breqdev breqdev released this 15 Aug 19:14
· 263 commits to main since this release
625ee52

Previously, each instance of AsyncContext created its own aiohttp ClientSession to send requests to Discord. However, it was unclear when to close this session, as background tasks could continue to make use of it after the initial response had been sent.

This release uses a ClientSession stored at the application level instead. This session is created using @app.before_serving and closed using @app.after_serving automatically for Quart apps. This is handled within app.set_route_async.

This release deprecates AsyncContext.close().