Module: Roda::RodaPlugins::PgDisconnect
- Defined in:
- lib/roda/plugins/pg_disconnect.rb
Overview
The pg_disconnect plugin recognizes any disconnection type errors, and kills the process if those errors are received. This is designed to be used only when using Unicorn as the web server, since Unicorn will respawn a new worker process. This kills the process with the QUIT signal, allowing Unicorn to finish handling the current request before exiting.
This is designed to be used with applications that cannot connect to the database after application initialization, either because they are restricting access to the database socket using unveil, or because they are using a firewall and access to the database server is not allowed from the application the process is running as after privileges are dropped.
This plugin must be loaded before the roda error_handler plugin, and it assumes usage of the Sequel database library with the postgres adapter and pg driver.
Defined Under Namespace
Modules: InstanceMethods
Class Method Summary collapse
Class Method Details
.load_dependencies(app) ⇒ Object
18 19 20 |
# File 'lib/roda/plugins/pg_disconnect.rb', line 18 def self.load_dependencies(app) raise RodaError, "error_handler plugin already loaded" if app.method_defined?(:handle_error) || app.private_method_defined?(:handle_error) end |