Skip to content

A platform for community discussion. Free, open, simple.

FIX: Cache all watched words (#14992)

Bianca Nenciu186379adac60
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