]> git.openstreetmap.org Git - rails.git/commitdiff
Raise exception if there is an error, and import tracepoints in batches
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 6 Mar 2019 08:27:33 +0000 (09:27 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 20 Mar 2019 09:35:40 +0000 (10:35 +0100)
app/models/trace.rb

index bd8ab72b3cfe340eb62ed068a8ac6068cab20fed..3d23d02c8d7da728c47f9234beb0a08873b6ea3f 100644 (file)
@@ -313,7 +313,7 @@ class Trace < ActiveRecord::Base
       tp.run_callbacks(:save) { false }
       tp.run_callbacks(:create) { false }
     end
-    Tracepoint.import(tracepoints)
+    Tracepoint.import!(tracepoints, :batch_size => 1_000)
 
     if gpx.actual_points.positive?
       max_lat = Tracepoint.where(:gpx_id => id).maximum(:latitude)