From 56ce3b0e2ca50dfb38cd84d7bf9973bb7e7b6223 Mon Sep 17 00:00:00 2001 From: Keith Garner Date: Wed, 7 Dec 2016 17:28:05 -0600 Subject: [PATCH] fix N+1 in gradebook importer. An assignment's context was being loaded once per assignment per student. This eliminates the N+1 by preloading the context with the assignments. closes CNVS-32664 test plan: - verify gradebook import still imports Change-Id: I024b6022dc3dc4279ce3d168da9ae15489e6274f Reviewed-on: https://gerrit.instructure.com/97031 Reviewed-by: Jeremy Neander Reviewed-by: Derek Bender Reviewed-by: Shahbaz Javeed Tested-by: Jenkins QA-Review: KC Naegle Product-Review: Keith T. Garner --- lib/gradebook_importer.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/gradebook_importer.rb b/lib/gradebook_importer.rb index e1d2765528c..862013d63c5 100644 --- a/lib/gradebook_importer.rb +++ b/lib/gradebook_importer.rb @@ -76,6 +76,7 @@ class GradebookImporter def parse! # preload a ton of data that presumably we'll be querying @all_assignments = @context.assignments + .preload(:context) .published .gradeable .select(ASSIGNMENT_PRELOADED_FIELDS)