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

mmd notifications at github.com
Wed Feb 6 19:03:08 UTC 2019

mmd-osm 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)

Re. batch size: https://github.com/zdennis/activerecord-import#batching mentions some parameter to control the max number of rows per INSERT.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190206/3f19146b/attachment-0001.html>

More information about the rails-dev mailing list