Skip to content

Generate stats - fix slow loading of media files. #731

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

Merged
merged 5 commits into from
Jul 18, 2015
Merged

Generate stats - fix slow loading of media files. #731

merged 5 commits into from
Jul 18, 2015

Conversation

tim-schilling
Copy link
Member

This pull request has been created to address the slow loading of media files from issue #517.

It uses the design that @spookylukey laid out of creating a method called generate_stats that will only be called when the toolbar will be inserted into the response.

generate_stats is not always called. It will only be called when
the toolbar is going to insert itself into the response. The method
process_response will always be called and should be used for panels
that need to interrupt the request such as the RedirectsPanel.

This update is to address issue #517.
While this hasn't caused any issues with the actual usage of the
toolbar, it has caused an unexpected error within the unit tests.
This is because the dictionary returned by stats is converted into
a list. The order of this list isn't consistent, while the logic
expects it to which gave it the random feel to it.

Ignoring the call to the disable should cause the view function
to be the only function with zero callers.
@aaugustin
Copy link
Contributor

This looks pretty good, please go ahead.

@aaugustin
Copy link
Contributor

One last thing: a line in the release notes would certainly help maintainers of third-party panels.

@tim-schilling
Copy link
Member Author

Thanks @aaugustin for the quick and thorough review! I'll get those changes made and merge this in.

Added a line for the 1.4 release which will contain this new
method.
Revised the sphinx method references for generate_stats and
process_response to actually link to each other. Following
the existing format to link to process_response lead to a
link being generated to Django's actual process_response
method on the middleware. I had to specifically mention the
toolbar's process_response and then updated the generate_stats
reference to be consistent between the two methods.
The func variable is a tuple, so each element needs to be checked
for the profiler.
tim-schilling added a commit that referenced this pull request Jul 18, 2015
Generate stats - fix slow loading of media files.
@tim-schilling tim-schilling merged commit 8dfd17a into django-commons:master Jul 18, 2015
ryneeverett pushed a commit to ryneeverett/django-debug-toolbar that referenced this pull request Oct 2, 2016
Generate stats - fix slow loading of media files.
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.

2 participants