From: Andy Allan Date: Wed, 16 Jan 2019 10:13:55 +0000 (+0100) Subject: Add a configuration flag for using the job queue to import traces X-Git-Tag: live~2739^2~3 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/581eca3bbe3f2e8a657d5f72afe6cbe261d4d8bf?hp=e59f1b610817ad8442bc639d479cebe0a851c05a Add a configuration flag for using the job queue to import traces This will allow the code to be merged to master, even if osm.org isn't ready to start using it yet. --- diff --git a/app/controllers/traces_controller.rb b/app/controllers/traces_controller.rb index d06c05b20..2e4997877 100644 --- a/app/controllers/traces_controller.rb +++ b/app/controllers/traces_controller.rb @@ -127,7 +127,7 @@ class TracesController < ApplicationController flash[:notice] = t ".trace_uploaded" flash[:warning] = t ".traces_waiting", :count => current_user.traces.where(:inserted => false).count if current_user.traces.where(:inserted => false).count > 4 - TraceImporterJob.perform_later(@trace) + TraceImporterJob.perform_later(@trace) if TRACE_USE_JOB_QUEUE redirect_to :action => :index, :display_name => current_user.display_name else flash[:error] = t("traces.create.upload_failed") if @trace.valid? @@ -211,7 +211,7 @@ class TracesController < ApplicationController trace.visible = false trace.save flash[:notice] = t ".scheduled_for_deletion" - TraceDestroyerJob.perform_later(trace) + TraceDestroyerJob.perform_later(trace) if TRACE_USE_JOB_QUEUE redirect_to :action => :index, :display_name => trace.user.display_name end rescue ActiveRecord::RecordNotFound diff --git a/config/example.application.yml b/config/example.application.yml index b6884825b..b0b468d9e 100644 --- a/config/example.application.yml +++ b/config/example.application.yml @@ -60,6 +60,10 @@ defaults: &defaults spam_threshold: 50 # Default legale (jurisdiction location) for contributor terms default_legale: GB + # Use the built-in jobs queue for importing traces + # Leave as false if you are using the external high-speed gpx importer + # https://github.com/openstreetmap/gpx-import + trace_use_job_queue: false # Location of GPX traces and images gpx_trace_dir: "/home/osm/traces" gpx_image_dir: "/home/osm/images"