From 0e8ab752a0b9cd7ffb4b2f9c8fb24d03a824229f Mon Sep 17 00:00:00 2001 From: nightpool Date: Sat, 15 Jun 2019 10:47:09 -0400 Subject: [PATCH] Use git commit hash as part of the cache key avoids issues with model caching being incompatible across versions --- lib/mastodon/redis_config.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/mastodon/redis_config.rb b/lib/mastodon/redis_config.rb index 10672a535..96c2c2309 100644 --- a/lib/mastodon/redis_config.rb +++ b/lib/mastodon/redis_config.rb @@ -26,9 +26,8 @@ def setup_redis_env_url(prefix = nil, defaults = true) setup_redis_env_url(:cache, false) setup_redis_env_url(:sidekiq, false) -namespace = ENV.fetch('REDIS_NAMESPACE', nil) -cache_namespace = namespace ? "#{namespace}_cache" : 'cache' -sidekiq_namespace = namespace +namespace = ENV.fetch('REDIS_NAMESPACE') { nil } +cache_namespace = [namespace, 'cache', `git rev-parse --short HEAD`].compact.join('_') REDIS_CACHE_PARAMS = { driver: :hiredis,