From db9e2800a861853441c3feeb8b4d74f9ff379d91 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 13 Nov 2018 14:45:02 +0100 Subject: [PATCH] Added temporary workaround for issue #2343 - Lost DB connection causes jobs to not be processed anymore. --- .../initializers/delayed_jobs_verify_db_connection.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 config/initializers/delayed_jobs_verify_db_connection.rb diff --git a/config/initializers/delayed_jobs_verify_db_connection.rb b/config/initializers/delayed_jobs_verify_db_connection.rb new file mode 100644 index 000000000..87d7a4527 --- /dev/null +++ b/config/initializers/delayed_jobs_verify_db_connection.rb @@ -0,0 +1,10 @@ +require 'delayed_job' + +module Delayed + class Job < ::ActiveRecord::Base + + def self.recover_from(_error) + ::ActiveRecord::Base.connection.verify! + end + end +end