Making a request to an issue http://localhost:5000/issues/2658
called session['user_id'] for http://localhost:5000/issues/2658
called AB testing for http://localhost:5000/issues/2658
called session['user_id'] for http://localhost:5000/api/issues/labels?per_page=100
called AB testing for http://localhost:5000/api/issues/labels?per_page=100
called session['user_id'] for http://localhost:5000/api/issues/labels?per_page=100
called AB testing for http://localhost:5000/csp-report
called AB testing for http://localhost:5000/api/issues/labels?per_page=100
called AB testing for http://localhost:5000/csp-report
AB testing calls could be fully avoided with:
# Set AB testing values
if app.config['AB_EXPERIMENTS']:
g.current_experiments = ab_current_experiments()
Then at first request, there are a lot of calls which are requesting login information, where it's completely unecessary.
called session['user_id'] for http://localhost:5000/issues/2658
called session['user_id'] for http://localhost:5000/dist/webcompat.css
called session['user_id'] for http://localhost:5000/dist/vendor.js
called session['user_id'] for http://localhost:5000/test-files/functional/lib/window-helpers.js
called session['user_id'] for http://localhost:5000/dist/webcompat.js
called session['user_id'] for http://localhost:5000/dist/issue-page.js
2
called session['user_id'] for http://localhost:5000/api/issues/labels?per_page=100
called session['user_id'] for http://localhost:5000/favicon/favicon-32x32.png
aka all of this:
called session['user_id'] for http://localhost:5000/dist/webcompat.css
called session['user_id'] for http://localhost:5000/dist/vendor.js
called session['user_id'] for http://localhost:5000/test-files/functional/lib/window-helpers.js
called session['user_id'] for http://localhost:5000/dist/webcompat.js
called session['user_id'] for http://localhost:5000/dist/issue-page.js
2
called session['user_id'] for http://localhost:5000/favicon/favicon-32x32.png
And here we could test some specific urls to avoid them.
@app.before_request
def before_request():
"""Set parameters in g before each request."""
g.user = None
tokens = ['/dist/', '/favicon/', '/csp-report']
avoid = any(s in request.path for s in tokens)
if ('user_id' in session) and (not avoid):
g.user = User.query.get(session['user_id'])
g.referer = get_referer(request) or url_for('index')
g.request_headers = request.headers
request.nonce = secrets.token_hex(20)
# Set AB testing values
if app.config['AB_EXPERIMENTS']:
g.current_experiments = ab_current_experiments()
That would return
called session['user_id'] for http://localhost:5000/issues/2658
called session['user_id'] for http://localhost:5000/test-files/functional/lib/window-helpers.js
2
called session['user_id'] for http://localhost:5000/api/issues/labels?per_page=100
Probably the session cookie is not necessary either. But that's separate.
@ksy36 do you know why it is calling
called session['user_id'] for http://localhost:5000/test-files/functional/lib/window-helpers.js
Before each request, webcompat app calls
def before_request():
https://github.com/webcompat/webcompat.com/blob/e56bd7c91d0940a76b89edc98e7378dff60db29f/webcompat/views.py#L60-L71
It checks a couple of things and stores data.
Making a request to an issue
http://localhost:5000/issues/2658
AB testing calls could be fully avoided with:
Then at first request, there are a lot of calls which are requesting login information, where it's completely unecessary.
aka all of this:
And here we could test some specific urls to avoid them.
That would return
Probably the session cookie is not necessary either. But that's separate.
@ksy36 do you know why it is calling