Skip to content

campaigns: Cache external changeset diffstats

Warren Gifford requested to merge aharvey/cache-external-changeset-diffs into master

Created by: LawnGnome

Fixes #11075 (closed).

The general approach here is to cache the changeset diffstat if the base or head OID has changed when we sync the changeset, then use that cached changeset when a GraphQL query is made that requires a campaign or changeset diffstat.

There is one observable behaviour change: closed changesets previously returned zero diffstats, but now return their actual diffstat. I think this is OK, and it simplifies the implementation, but we could force the syncer to cache zeroes for closed changesets to return to the old behaviour. I've kept the relevant test change in a separate commit for now to make it easier to change this if necessary.

Since campaign diffstats require knowledge of which changesets are accessible to the user, I've elected to use the simple approach for now of continuing to use the GraphQL connection. (See the discussion below between @mrnugget and I for more detail.) This is technically suboptimal, as we're pulling in sync data that we don't need to, but I think that's likely OK pending further work on being able to resolve permissions at the store level. I'm also happy to attempt @mrnugget's suggested optimisation in a future PR.

Merge request reports

Loading