diff --git a/app/services/random_topic_selector.rb b/app/services/random_topic_selector.rb
index 8ce962f76..7c2026b5e 100644
--- a/app/services/random_topic_selector.rb
+++ b/app/services/random_topic_selector.rb
@@ -72,6 +72,7 @@ class RandomTopicSelector
     Category.select(:id).each do |c|
       $redis.del cache_key(c)
     end
+    $redis.del cache_key
   end
 
   def self.cache_key(category=nil)
diff --git a/lib/topic_query.rb b/lib/topic_query.rb
index 8269050bf..0b21c04e7 100644
--- a/lib/topic_query.rb
+++ b/lib/topic_query.rb
@@ -425,7 +425,7 @@ class TopicQuery
       max = (count*1.3).to_i
       ids = RandomTopicSelector.next(max) + RandomTopicSelector.next(max, topic.category)
 
-      result.where(id: ids)
+      result.where(id: ids.uniq)
     end
 
     def suggested_ordering(result, options)
diff --git a/spec/components/topic_query_spec.rb b/spec/components/topic_query_spec.rb
index 5478add66..be4df3ae6 100644
--- a/spec/components/topic_query_spec.rb
+++ b/spec/components/topic_query_spec.rb
@@ -432,6 +432,10 @@ describe TopicQuery do
 
     context 'when logged in' do
 
+      before do
+        RandomTopicSelector.clear_cache!
+      end
+
       let(:topic) { Fabricate(:topic) }
       let(:suggested_topics) { topic_query.list_suggested_for(topic).topics.map{|t| t.id} }
 
@@ -450,7 +454,6 @@ describe TopicQuery do
         let!(:fully_read_archived) { Fabricate(:post, user: creator).topic }
 
         before do
-          RandomTopicSelector.clear_cache!
           user.auto_track_topics_after_msecs = 0
           user.save
           TopicUser.update_last_read(user, partially_read.id, 0, 0)
@@ -463,6 +466,17 @@ describe TopicQuery do
           fully_read_archived.save
         end
 
+
+        it "returns unread, then new, then random" do
+          SiteSetting.suggested_topics = 7
+          expect(suggested_topics[0]).to eq(partially_read.id)
+          expect(suggested_topics[1,3]).to include(new_topic.id)
+          expect(suggested_topics[1,3]).to include(closed_topic.id)
+          expect(suggested_topics[1,3]).to include(archived_topic.id)
+          expect(suggested_topics[4]).to eq(fully_read.id)
+          # random doesn't include closed and archived
+        end
+
         it "won't return new or fully read if there are enough partially read topics" do
           SiteSetting.suggested_topics = 1
           expect(suggested_topics).to eq([partially_read.id])
@@ -476,16 +490,6 @@ describe TopicQuery do
           expect(suggested_topics[1,3]).to include(archived_topic.id)
         end
 
-        # it "returns unread, then new, then random" do
-        #   SiteSetting.suggested_topics = 7
-        #   expect(suggested_topics[0]).to eq(partially_read.id)
-        #   expect(suggested_topics[1,3]).to include(new_topic.id)
-        #   expect(suggested_topics[1,3]).to include(closed_topic.id)
-        #   expect(suggested_topics[1,3]).to include(archived_topic.id)
-        #   expect(suggested_topics[4]).to eq(fully_read.id)
-        #   # random doesn't include closed and archived
-        # end
-
       end
     end