Skip to content

Include position in the cache key of DiffDiscussion

Patrick Bajao requested to merge 336054-diff-note-discussion-cache into master

What does this MR do?

In #332967 (closed), we introduced caching on discussions endpoint.

Upon testing it further while rolling it out, found a bug wherein the diff note that should still be displayed won't display anymore because position changed. The position stored in cache no longer applies as it's outdated.

With this fix, we include the position of the first note in diff discussion (as sha) in the cache_key. This way, when the position changes, the cache key will be updated and will result to a cache miss and will return updated data.

No changelog trailer as the feature utilizing the cache key is behind a feature flag.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Related to #336054 (closed)

Edited by Patrick Bajao

Merge request reports