FEATURE: Remove restrictions from the chat messages export (#22854)

Now, when we took care of performance in fbe0e4c and ad05924 
there is no need anymore to restrict the export to
- 6 months
- 10000 rows
This commit is contained in:
Andrei Prigorshnev 2023-07-28 17:04:57 +04:00 committed by GitHub
parent 263afe6b6a
commit cd45f33430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,12 +2,10 @@
module Chat
module MessagesExporter
LIMIT = 10_000
def chat_message_export(&block)
# perform 1 db query per month:
now = Time.now
from = 6.months.ago
from = oldest_message_date
while from <= now
export(from, from + 1.month, &block)
from = from + 1.month
@ -38,6 +36,10 @@ module Chat
private
def oldest_message_date
Chat::Message.order(:created_at).pick(:created_at)
end
def export(from, to)
Chat::Message
.unscoped
@ -45,7 +47,6 @@ module Chat
.includes(:chat_channel)
.includes(:user)
.includes(:last_editor)
.limit(LIMIT)
.find_each do |chat_message|
yield(
[