diff --git a/app/models/scheduler.rb b/app/models/scheduler.rb index 0b2825abe..5637249e9 100644 --- a/app/models/scheduler.rb +++ b/app/models/scheduler.rb @@ -11,6 +11,13 @@ class Scheduler < ApplicationModel Thread.abort_on_exception = true + # reconnect in case db connection is lost + begin + ActiveRecord::Base.connection.reconnect! + rescue => e + logger.error "Can't reconnect to database #{e.inspect}" + end + # cleanup old background jobs cleanup