Skip to content

Clear issuable count cache on update

Well, this got complicated. I did https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12457 but there were (at least!) three issues with it:

  1. The cache keys included the state you were looking at, even though that was irrelevant (the cache values contain the counts for all states). This meant extra cache keys, but wasn't a huge deal.
  2. The cache keys sometimes included routing params, like controller, meaning it was hard to reuse them, and we actually weren't 🤦
  3. Caches weren't reset when an issuable went through a state change, so this fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/34772.

I think longer-term we might want separate finder objects to be responsible for counting, and also responsible for their own caching. But this is a regression and this is the simplest way I could think of fixing it.

(Also, the feature spec is crazy, but it runs in 15 seconds locally and found a lot of bugs, including the ones I mentioned above.)

Merge request reports

Loading