-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Refactor the code to initialize event loop only from async functions #247
Comments
Making this a release blocker because when upgrading the packages, |
There are still some issues and |
This has been implemented. Further testing is required |
This seems to work fine. If some bugs occur after further user testing those can be fixed separately |
The time has come. Python 3.10 is released which means that our old ways won't work, and new event loop would be created always.
Recently our tests got broken because of fastapi 0.69.0 release, which uses anyio. We had many issues with
too many concurrent operations in progress
because of event loop mismatch, and are using some workarounds inpytest-asyncio
to make everything use same event loop:https://github.com/bitcartcc/bitcart/blob/ac129fae929d0853137d327762ef7750537627b6/tests/conftest.py#L32-L34
https://github.com/bitcartcc/bitcart/blob/ac129fae929d0853137d327762ef7750537627b6/tests/conftest.py#L38
https://github.com/bitcartcc/bitcart/blob/ac129fae929d0853137d327762ef7750537627b6/tests/conftest.py#L44
SDK might need to be refactored as well.
settings.py
should be refactored to a class, most initialization might be moved to other files, possiblyWorker
class could be introduced to initializeworker.py
. Adding new scheduled tasks system could be refactored as well.redis pool and other connections need to be created on startup from async functions, not on import. Test suite workarounds should be removed and it should just work
If everything works then we can probably remove
asyncio.get_event_loop().run_until_complete
in favour ofasyncio.run
The text was updated successfully, but these errors were encountered: