mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
further reduce batch size to avoid exceeding memory quota
This commit is contained in:
parent
318bbb01ea
commit
9ae94a2dae
1 changed files with 2 additions and 2 deletions
|
|
@ -7,12 +7,12 @@ class SurveyResponsesDataLoader
|
|||
File.open(filepath) do |file|
|
||||
headers = file.first
|
||||
|
||||
file.lazy.each_slice(500) do |lines|
|
||||
file.lazy.each_slice(100) do |lines|
|
||||
survey_item_responses = CSV.parse(lines.join, headers:).map do |row|
|
||||
process_row row: Values.new(row:, headers:)
|
||||
end
|
||||
|
||||
SurveyItemResponse.import survey_item_responses.compact.flatten, batch_size: 500
|
||||
SurveyItemResponse.import survey_item_responses.compact.flatten, batch_size: 100
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue