FIX: Use LRANGE + LTRIM instead of LPOP with count (#45)

FIX: Use LRANGE + LTRIM instead of LPOP with count (#45)

LPOP with count parameter is supported only since Redis 6.2.

diff --git a/lib/discourse_algolia/indexer.rb b/lib/discourse_algolia/indexer.rb
index f64bfef..8321e72 100644
--- a/lib/discourse_algolia/indexer.rb
+++ b/lib/discourse_algolia/indexer.rb
@@ -34,7 +34,9 @@ class DiscourseAlgolia::Indexer
   end
 
   def queue_ids
-    Discourse.redis.lpop(self.class::QUEUE_NAME, 100)&.map(&:to_i)&.uniq || []
+    ids = Discourse.redis.lrange(self.class::QUEUE_NAME, 0, QUEUE_SIZE - 1)
+    Discourse.redis.ltrim(self.class::QUEUE_NAME, ids.size, -1)
+    ids.map(&:to_i).uniq
   end
 
   def queue(ids)

GitHub sha: ad576d70b98119eec2aa33fdae64c61e85b45775

This commit appears in #45 which was approved by ZogStriP. It was merged by udan11.