-
Notifications
You must be signed in to change notification settings - Fork 12
lazy initialize for gevent #2011
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @terrazoon!
I agree about testing this in isolation when we merge it - I had one question on the new methods introduced, but I could very well not be seeing something!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again, @terrazoon!
Description
Because of the use of gevent and its need for monkey patching, it's necessary that all global variables that use resources be lazily initialized. This way the monkey patching works for the whole app, and we don't get fork errors under heavy load.
In the PR we do lazy initialization of all the 'easy' global variables, which don't hit too many files.
Note: This PR is a bit risky. Even though I ran a bulk send test locally and it was successful, the PR might destabilize staging. So we should push it to staging on its own and QA test it on its own, and be ready to rollback.
Security Considerations
N/A