Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event loop is acquired too early #3

Open
jonafato opened this issue Nov 5, 2016 · 0 comments
Open

Event loop is acquired too early #3

jonafato opened this issue Nov 5, 2016 · 0 comments
Labels

Comments

@jonafato
Copy link
Contributor

jonafato commented Nov 5, 2016

When the AsyncIOMotorClient is initialized in init_app, asyncio.get_event_loop is called, and a reference to the event loop is stored. This can cause problems when a loop other than the default is used (e.g. uvloop or the loop created by Henson's CLI's reloader).

To address this, the creation of the client should be deferred. The easiest approach here is to use the app.startup hook to create the client when the application is starting rather than during the extension's initialization. (Are there other / better options here, as well?)

@jonafato jonafato added the bug label Nov 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant