Fixed issue #1405 - Scheduler not running because of Bad file descriptor in PGConsumeInput().
This commit is contained in:
parent
18edd73c75
commit
1ba32b1a41
2 changed files with 6 additions and 2 deletions
|
@ -12,10 +12,8 @@ class Scheduler < ApplicationModel
|
|||
Thread.abort_on_exception = true
|
||||
|
||||
# reconnect in case db connection is lost
|
||||
# See issue #1080
|
||||
begin
|
||||
ActiveRecord::Base.connection.reconnect!
|
||||
rescue PG::UnableToSend => e # rubocop:disable Lint/HandleExceptions
|
||||
rescue => e
|
||||
logger.error "Can't reconnect to database #{e.inspect}"
|
||||
end
|
||||
|
|
|
@ -16,6 +16,12 @@ require 'daemons'
|
|||
|
||||
def before_fork
|
||||
|
||||
# clear all connections before for, reconnect later ActiveRecord::Base.connection.reconnect!
|
||||
# issue #1405 - Scheduler not running because of Bad file descriptor in PGConsumeInput()
|
||||
# https://github.com/zammad/zammad/issues/1405
|
||||
# see also https://bitbucket.org/ged/ruby-pg/issues/260/frequent-crashes-with-multithreading
|
||||
ActiveRecord::Base.clear_all_connections!
|
||||
|
||||
# remember open file handles
|
||||
@files_to_reopen = []
|
||||
ObjectSpace.each_object(File) do |file|
|
||||
|
|
Loading…
Reference in a new issue