mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: Increase performance of large csv exports for User Histories (#22008)
* PERF: Increase performance of large csv exports for User Histories * added find_each for screened_email_export
This commit is contained in:
parent
e0f848c2ea
commit
1a27e715ee
@ -92,7 +92,6 @@ module Jobs
|
|||||||
|
|
||||||
# ensure directory exists
|
# ensure directory exists
|
||||||
FileUtils.mkdir_p(dirname) unless Dir.exist?(dirname)
|
FileUtils.mkdir_p(dirname) unless Dir.exist?(dirname)
|
||||||
|
|
||||||
# Generate a compressed CSV file
|
# Generate a compressed CSV file
|
||||||
begin
|
begin
|
||||||
entities.each do |entity|
|
entities.each do |entity|
|
||||||
@ -177,7 +176,7 @@ module Jobs
|
|||||||
UserHistory.where(admin_only: false).only_staff_actions.order("id DESC")
|
UserHistory.where(admin_only: false).only_staff_actions.order("id DESC")
|
||||||
end
|
end
|
||||||
|
|
||||||
staff_action_data.each { |staff_action| yield get_staff_action_fields(staff_action) }
|
staff_action_data.find_each { |staff_action| yield get_staff_action_fields(staff_action) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def screened_email_export
|
def screened_email_export
|
||||||
@ -185,7 +184,7 @@ module Jobs
|
|||||||
|
|
||||||
ScreenedEmail
|
ScreenedEmail
|
||||||
.order("last_match_at DESC")
|
.order("last_match_at DESC")
|
||||||
.each { |screened_email| yield get_screened_email_fields(screened_email) }
|
.find_each { |screened_email| yield get_screened_email_fields(screened_email) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def screened_ip_export
|
def screened_ip_export
|
||||||
|
Loading…
Reference in New Issue
Block a user