diff options
| author | cedricnjanga | 2018-05-09 14:43:59 -0700 |
|---|---|---|
| committer | Johan Van Ryseghem | 2018-05-28 16:20:55 +0200 |
| commit | 3f7c4b11e27fba2abba6e5bfa676f41b886896e5 (patch) | |
| tree | 33cf802458b7de806bd839dddfd6f649d99a174f /lib/cron.rb | |
| parent | 547f8a408883a36f91b1335b67bb9c22de7fbca8 (diff) | |
| download | chouette-core-3f7c4b11e27fba2abba6e5bfa676f41b886896e5.tar.bz2 | |
Refs #6952 Add missing begin/rescue
Diffstat (limited to 'lib/cron.rb')
| -rw-r--r-- | lib/cron.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/cron.rb b/lib/cron.rb index 0b94c2209..7e2ca4cdf 100644 --- a/lib/cron.rb +++ b/lib/cron.rb @@ -2,18 +2,26 @@ module Cron class << self def sync_organizations - Organisation.portail_sync + begin + Organisation.portail_sync + rescue => e + Rails.logger.error(e.inspect) + end end def sync_users - User.portail_sync + begin + User.portail_sync + rescue => e + Rails.logger.error(e.inspect) + end end def sync_reflex begin sync = StopAreaReferential.find_by(name: 'Reflex').stop_area_referential_syncs.build raise "reflex:sync aborted - There is already an synchronisation in progress" unless sync.valid? - sync.save if sync.valid? + sync.save rescue => e Rails.logger.warn(e.message) end @@ -23,7 +31,7 @@ module Cron begin sync = LineReferential.find_by(name: 'CodifLigne').line_referential_syncs.build raise "Codifligne:sync aborted - There is already an synchronisation in progress" unless sync.valid? - sync.save if sync.valid? + sync.save rescue => e Rails.logger.warn(e.message) end |
