Project

General

Profile

« Previous | Next » 

Revision 1d96432a

Added by Ivan Necas about 10 years ago

Reinitialize the dynflow world after forking

One last monkey-patch to delayed-jobs addressing `PGError: could not
receive data from server: Bad file descriptor`.

We should get rid of DJ really soon.

View differences:

config/initializers/delayed_job.rb
Delayed::Worker.logger.error(error.backtrace.join("\n"))
end
alias_method_chain :handle_failed_job, :loggin
class << self
def after_fork_with_dynflow(*args)
after_fork_without_dynflow(*args)
if ForemanTasks.dynflow.initialized?
# Delayed jobs runs with daemons which means we need to reinitialize
# the world after forking to reopen the db connection
ForemanTasks.dynflow.reinitialize!
end
end
alias_method_chain :after_fork, :dynflow
end
end
end

Also available in: Unified diff