Skip to content

Cache diff stats on Patches

Created by: mrnugget

Right now we always compute a Campaign's diff stat on the fly, by loading the unpublished patch sets from the database, parsing the diff and computing the diff stats:

https://github.com/sourcegraph/sourcegraph/blob/743e4955e57eb463f2414f62c77ab966865eb8cd/enterprise/internal/campaigns/resolvers/campaigns.go#L321-L333

Since patches are immutable, we can cache this in the database.