Support for rendering/redacting multiple documents
What does this MR do?
This MR does two things:
- Separate redacting HTML documents from the htm-pipeline Gem and support redacting multiple documents at once
- Add code that supports rendering and redacting multiple Markdown documents
See commit d7dc68ef878d2ad032efa92e25a8fa77250f9099 for more information.
Are there points in the code the reviewer needs to double check?
Yes. The way notes are currently gathered in the controllers is something I'm not very fond of.
Why was this MR needed?
Most of this is explained in d7dc68ef878d2ad032efa92e25a8fa77250f9099 but in short:
- Redacting happened per document, leading to lots of queries being executed for every comment.
- On GitLab.com between 1 and ~2.5 seconds is spent in redacting documents per request to
Projects::IssuesController#show
- Redacting multiple documents at once greatly reduces the number of SQL queries executed.
What are the relevant issue numbers?
Screenshots (if relevant)
Before/after of the method timings:
Here the green bars are the timings for the RedactorFilter#call
method, the orange-ish timings are for Banzai::Redactor#redact
.
SQL query count impact:
Here the big drop just before 12:30 is when I switched to the branch of this MR, the number of queries dropped from around 4000 to around 2600.
Does this MR meet the acceptance criteria?
-
CHANGELOG entry added -
Documentation created/updated -
API support added - Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the style guides -
Branch has no merge conflicts with master
(if you do - rebase it please) -
Squashed related commits together