FIX: Update word_watcher cache key following schema change (#17755)

862007fb18 introduced a change to the format that watched words are cached in Redis. Newly-deployed versions of the app were attempting to load the old-format data from Redis, leading to a server error. This commit introduces a CACHE_VERSION constant which we can easily bump when making changes to the cache schema.
This commit is contained in:
David Taylor 2022-08-02 12:11:08 +01:00 committed by GitHub
parent 4bf9b73296
commit 381365facc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -2,6 +2,7 @@
class WordWatcher
REPLACEMENT_LETTER ||= CGI.unescape_html("■")
CACHE_VERSION = 2
def initialize(raw)
@raw = raw
@ -105,7 +106,7 @@ class WordWatcher
end
def self.word_matcher_regexp_key(action)
"watched-words-list:#{action}"
"watched-words-list:v#{CACHE_VERSION}:#{action}"
end
def self.censor(html)