diff options
| author | Johan Van Ryseghem | 2018-02-13 09:08:18 +0100 |
|---|---|---|
| committer | GitHub | 2018-02-13 09:08:18 +0100 |
| commit | 81cb1f8251e3506f7c75a229aabeaba3a83e6d8a (patch) | |
| tree | 1f35d87dba085495d31cf4588e67e3c3fa15089d /app | |
| parent | 551c1117a4b9872c99508da71427f5a28fc31ddc (diff) | |
| parent | 2e346505cbf2f82c5aaf6fca37966a39b6c9656c (diff) | |
| download | chouette-core-81cb1f8251e3506f7c75a229aabeaba3a83e6d8a.tar.bz2 | |
Merge pull request #287 from af83/4963-import-cron-should-abort-old-imports
4963 import cron should abort old imports
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/import.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/import.rb b/app/models/import.rb index d8e763bf3..29aadcd56 100644 --- a/app/models/import.rb +++ b/app/models/import.rb @@ -44,6 +44,14 @@ class Import < ActiveRecord::Base %w(successful failed warning aborted canceled) end + def self.abort_old + where( + 'created_at < ? AND status NOT IN (?)', + 4.hours.ago, + finished_statuses + ).update_all(status: 'aborted') + end + def notify_parent parent.child_change update(notified_parent_at: DateTime.now) |
