Whitespace fixes for oauth_clients erb files
[rails.git] / app / jobs / trace_importer_job.rb
1 class TraceImporterJob < ApplicationJob
2   queue_as :traces
3
4   def perform(trace)
5     gpx = trace.import
6
7     if gpx.actual_points.positive?
8       Notifier.gpx_success(trace, gpx.actual_points).deliver_later
9     else
10       Notifier.gpx_failure(trace, "0 points parsed ok. Do they all have lat,lng,alt,timestamp?").deliver_later
11       trace.destroy
12     end
13   rescue StandardError => ex
14     logger.info ex.to_s
15     ex.backtrace.each { |l| logger.info l }
16     Notifier.gpx_failure(trace, ex.to_s + "\n" + ex.backtrace.join("\n")).deliver_later
17     trace.destroy
18   end
19 end