[openstreetmap/openstreetmap-website] Use activerecord-import for bulk importing tracepoint records (#2131)

Tom Hughes notifications at github.com
Wed Mar 13 13:00:53 UTC 2019


tomhughes commented on this pull request.



>      end
 
+    # Run the before_save and before_create callbacks, and then import them in bulk with activerecord-import
+    tracepoints.each do |tp|
+      tp.run_callbacks(:save) { false }
+      tp.run_callbacks(:create) { false }
+    end
+    Tracepoint.import(tracepoints)

Well that stops us generating one mammoth SQL statement yes, but it still creates in-memory objects for all the points. Not sure whether that is actually an issue or not?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2131#discussion_r265113614
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190313/efda6ef3/attachment.html>


More information about the rails-dev mailing list