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

Use app stored on self during operation #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BookLaugh
Copy link

If current_app is used directly, it fails to recognize configuration changes. I spent last hour investigating it in our setup where we use Flask with uwsgi and app instance is created later, in a function, not on global level code. This means that 'current_app' pointer is instantiated before QueryInspect object is created. Our code creates QueryInspect object with app object passed to init. And during after_request() call, self.app is not current_app (more precisely: self.app is current_app evaluates to False).

The fix is very small and I can see no reason it could break QueryInspect - actually it makes it more explicit in using app instance passed in init, instead of relying on current_app.

If current_app is used directly, it fails to recognize configuration changes. I spent last hour investigating it in our setup where we use Flask with uwsgi and app instance is created later, in a function, not on global level code. This means that 'current_app' pointer is instantiated before QueryInspect object is created. Our code creates QueryInspect object with app object passed to init. And during after_request() call, self.app is not current_app (more precisely: `self.app is current_app` evaluates to False).

The fix is very small and I can see no reason it could break QueryInspect - actually it makes it more explicit in using app instance passed in init, instead of relying on current_app.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant