]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/trace.rb
Merge pull request #4536 from tomhughes/trace-size-limit
[rails.git] / app / models / trace.rb
index be5d0a6318c0219c11c1c3499daaab3411cd86cd..818cc363b8629595bed5a4d842033f708598f14c 100644 (file)
@@ -202,7 +202,7 @@ class Trace < ApplicationRecord
     logger.info("GPX Import importing #{name} (#{id}) from #{user.email}")
 
     file.open do |file|
-      gpx = GPX::File.new(file.path)
+      gpx = GPX::File.new(file.path, :maximum_points => Settings.max_trace_size)
 
       f_lat = 0
       f_lon = 0
@@ -268,7 +268,7 @@ class Trace < ApplicationRecord
   end
 
   def schedule_import
-    TraceImporterJob.perform_later(self)
+    TraceImporterJob.new(self).enqueue(:priority => user.traces.where(:inserted => false).count)
   end
 
   def schedule_destruction