Bug 1190171 - Revision content denormalization and other cleanups of the compare revision view.#3386
Bug 1190171 - Revision content denormalization and other cleanups of the compare revision view.#3386groovecoder merged 6 commits intomasterfrom
Conversation
jezdez
commented
Aug 4, 2015
- Adds ratelimiting to the compare revision view.
- Refactors the signal handling to use new patterns and less confusing code.
- Prefetch revision tags and document for fewer queries.
- Denormalize the revision content in a separate field that is filled on save and uses tidy to do the CPU-intense work once instead of on every request.
|
So this does a bunch of things, which we don't have to do all at once, but I wanted to offer it anyway since I think we shouldn't run tidy on every request of that view but keep the tidied revision content on file instead. The other changes are probably less troubling. |
There was a problem hiding this comment.
Ah, this is a good way to preserve the submitted data (in the content field) and store the tidied content. But should we populate the tidied_content field when it's accessed via get_tidied_content() or should we just populate it when the Revision is saved?
There was a problem hiding this comment.
It's populated both, see https://github.com/mozilla/kuma/pull/3386/files#diff-a103da980103930e43dab15a81a2a4f5R128
There was a problem hiding this comment.
The idea is to not have to go through all the hundred of thousands revisions at once but spread it a bit. Updating the tidied content on access is only useful for old revisions, the post_save hook is for all new revisions.
There was a problem hiding this comment.
Doh, sorry I over-looked that; I jumped straight to this models.py diff to see what you did here.
|
❤️ using Django 1.7 app system. |
880d013 to
ecd578f
Compare
|
Needs a rebase now. |
This makes use of Django's new app loading classes that are guarenteed to connect the signals at startup and is the recommended way of doing this. This also moves the search index config into the wiki app.
That reduces the number of queries being done when rendering the view.
…INSTALLED_APPS items.
|
Intern tests pass. Spot-check on |
kuma/wiki/tasks.py
Outdated
|
I actually decided to increase the rate limit of the tidy_revision_content Celery task to That said I agree that there is a big risk with scheduling Celery tasks on every call to |
This will be filled on post_save and via a Celery task and occasionally for older revisions on demand (also via Celery). The task is rate limited in a way to be able to get through the ~550k revisions rather quickly.
|
Note: It's set to |
|
@groovecoder woops, good catch! Edit: Fixed. |
Bug 1190171 - Revision content denormalization and other cleanups of the compare revision view.