aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-02-05 16:11:03 +0100
committerTeddy Wing2018-02-06 10:50:51 +0100
commitbe1e4ce05348e722e52c2e68f5b1c1514caa00dd (patch)
tree55d69b2d76b9a47c1f7b06e7b821b705c90de08a
parent95536ec9ffe465cb591bab3c1e770264440a7c8a (diff)
downloadchouette-core-be1e4ce05348e722e52c2e68f5b1c1514caa00dd.tar.bz2
schedule.rb: Abort old imports before import notification
As a result of a new requirement, before doing the existing work we were doing in the imports cron job (notifying parent imports), we first need to clear out old imports and mark them as 'aborted'. Refs #4963
-rw-r--r--config/schedule.rb1
-rw-r--r--lib/tasks/imports.rake5
2 files changed, 6 insertions, 0 deletions
diff --git a/config/schedule.rb b/config/schedule.rb
index 08488c255..636ab654e 100644
--- a/config/schedule.rb
+++ b/config/schedule.rb
@@ -40,6 +40,7 @@ every :day, :at => '4:00 am' do
end
every 5.minutes do
+ rake "import:abort_old"
rake "import:notify_parent"
end
diff --git a/lib/tasks/imports.rake b/lib/tasks/imports.rake
index 6bc84acc8..fee850b23 100644
--- a/lib/tasks/imports.rake
+++ b/lib/tasks/imports.rake
@@ -3,4 +3,9 @@ namespace :import do
task notify_parent: :environment do
ParentImportNotifier.notify_when_finished
end
+
+ desc "Mark old unfinished imports as 'aborted'"
+ task abort_old: :environment do
+ Import.abort_old
+ end
end