From 07fdcf638ea8f7200b561f4cc190f231929cda0b Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 6 Mar 2019 09:27:33 +0100 Subject: [PATCH 1/1] Raise exception if there is an error, and import tracepoints in batches --- app/models/trace.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/trace.rb b/app/models/trace.rb index bd8ab72b3..3d23d02c8 100644 --- a/app/models/trace.rb +++ b/app/models/trace.rb @@ -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) -- 2.45.1