From 9934286a33ecb260e542567a48b1f94c38011a37 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Sat, 13 May 2017 15:50:28 +0200 Subject: [PATCH] Fixed issue #1080 - Scheduler won't start because of missing DB connection on PostgreSQL 9.2.18. --- app/models/scheduler.rb | 7 +++++++ 1 file changed, 7 insertions(+) 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