From 186379adac60048264d75c98f42da4b8c7d02fe2 Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Wed, 17 Nov 2021 18:59:44 +0200 Subject: [PATCH] FIX: Cache all watched words (#14992) It used to cache up to 1000 words, but the maximum number of watched word is 2000. --- app/services/word_watcher.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/services/word_watcher.rb b/app/services/word_watcher.rb index 1927ac9474b..91d795a9d98 100644 --- a/app/services/word_watcher.rb +++ b/app/services/word_watcher.rb @@ -8,7 +8,10 @@ class WordWatcher end def self.words_for_action(action) - words = WatchedWord.where(action: WatchedWord.actions[action.to_sym]).limit(1000) + words = WatchedWord + .where(action: WatchedWord.actions[action.to_sym]) + .limit(WatchedWord::MAX_WORDS_PER_ACTION) + if WatchedWord.has_replacement?(action.to_sym) words.pluck(:word, :replacement).to_h else