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 bd8ab72..3d23d02 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)