Fix caching issues in the diff viewer with interdiffs.
Review Request #7709 — Created Oct. 17, 2015 and submitted — Latest diff uploaded
The diff viewer had a caching bug that people noticed when using
interdiffs. Essentially, updating the diff and viewing its interdiff
resulted in the old diff being displayed.The reason this happened is that
DiffFragmentView.make_etag()
was
expecting aDiffSet
ID, but this wasn't actually available at this
point. We didn't have DiffSet information until later, after the caching
checks, so we couldn't include any of its identifying information.Rather than regress the performance of the diff viewer by moving the
database access before the caching checks, I've opted to extend the URL
format to take an interfilediff ID. This gives us all the information
needed to sanely cache fragments without incurring any performance
penalties.
Tested diffs and interdiffs of different types in the diff viewer. Saw that
the content had a new ETag every time a diff was updated, and for every
diff revision range.Unit tests pass (both Python and JavaScript).