FIX: iterate when clearing watched words cache

FIX: iterate when clearing watched words cache

diff --git a/app/services/word_watcher.rb b/app/services/word_watcher.rb
index 762f56c..0cddc96 100644
--- a/app/services/word_watcher.rb
+++ b/app/services/word_watcher.rb
@@ -41,7 +41,7 @@ class WordWatcher
   end
 
   def self.clear_cache!
-    WatchedWord.actions.sum do |a, i|
+    WatchedWord.actions.each do |a, i|
       Discourse.cache.delete word_matcher_regexp_key(a)
     end
   end

GitHub sha: 6de254f6

2 Likes

This was breaking some plugin migrations (from scratch) when watched words were also being seeded, and I can’t see why this was using sum in the first place.

1 Like

Yeah, not sure either. @nlalonde any idea? :thinking:

No idea. Looks like it was a bug.

2 Likes