Skip to content

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

DEV: Fix the channel archive spec flake (again) (#39579)

Jarek Radosz7574a535991c
diff --git a/plugins/chat/lib/chat/channel_archive_service.rb b/plugins/chat/lib/chat/channel_archive_service.rb
index 56338ef035a..e2883c5488c 100644
--- a/plugins/chat/lib/chat/channel_archive_service.rb
+++ b/plugins/chat/lib/chat/channel_archive_service.rb
@@ -114,8 +114,11 @@ module Chat
chat_channel
.chat_messages
- .order("created_at ASC, id ASC")
- .find_in_batches(batch_size: ARCHIVED_MESSAGES_PER_POST) do |message_batch|
+ .find_in_batches(
+ batch_size: ARCHIVED_MESSAGES_PER_POST,
+ cursor: %i[created_at id],
+ order: :asc,
+ ) do |message_batch|
thread_ids = message_batch.map(&:thread_id).compact.uniq
threads =
chat_channel