Skip to content

Implement syntax highlighting on diffs

Warren Gifford requested to merge es/diff-syntax-highlighting into master

Created by: eseliger

This works on all diff views and for performance reasons also adds cursor based pagination to the fileDiffs

Commit page: image

Campaigns diffs: image

Closes #9166 (closed)

Thoughts on performance:

In order to keep the performance impact relatively low, all pages requesting highlighted diffs are requesting 15 files at most at a time. Therefore, I added cursor based pagination to the fileDiffs. Hence, every request (that the webapp makes) will never require more than those 15. That means: 30 requests to gitserver and 30 requests to syntect at most. I don't see much more of a problem with this endpoint compared to others we have, which we are ok with as well. (Ie., 'get 100 repos and their default branch' issues 100 requests to gitserver).

I do see the risk of someone issuing a request for 10000 fileDiffs (including the highlight, otherwise it won't have impact). But I don't think that introduces a new risk to our API. Most endpoints do not have any limitations and do expose a certain risk of not gracefully handling this. The best way to get around all those issues would probably be cost estimation of queries prior to running them, which would be a single solution to fix them all.

Given that, I don't see us exposing some big point of risk here, as it's not a new thing to our API that there are certain longer running queries.

Merge request reports

Loading