Skip to content

Commit

Permalink
Use git commit hash as part of the cache key
Browse files Browse the repository at this point in the history
avoids issues with model caching being incompatible across versions
  • Loading branch information
nightpool committed Mar 17, 2024
1 parent 07a7b7e commit 0e8ab75
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/mastodon/redis_config.rb
Expand Up @@ -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,
Expand Down

0 comments on commit 0e8ab75

Please sign in to comment.