Skip to content

Update Gitlab::JsonCache cache_key to include Gitlab.revision by default

What does this MR do and why?

This MR is a corrective action for Incident 6372

Currently, broadcast message cache expires every 2 weeks. This is too infrequent and has caused stale data issue (see Incident 6372) after a new attribute was added to BroadcastMessage without invalidating the cache.

This MR updates Gitlab::JsonCache to add Gitlab.revision to the cache key by default and also updates BroadcastMessage to use this default cache configuration. The change will invalidate cached broadcast messages (and anything that uses Gitlab::JsonCache going forward) on every deployment to prevent the same stale data issue.

For backwards compatibility, Gitlab::JsonCache accepts { cache_key_strategy: :version } (adds Gitlab::VERSION and Rails.version to the cache_key) which will invalidate the cache on every bump of Gitlab::VERSION (every release, once a month) and Rails.version.

Screenshots or screen recordings

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Eugie Limpin

Merge request reports

Loading