[Rt-commit] rt branch, 4.2/database-error-503, created. rt-4.2.3-58-gb5b0464
Alex Vandiver
alexmv at bestpractical.com
Tue Mar 25 10:37:07 EDT 2014
The branch, 4.2/database-error-503 has been created
at b5b04647fe9281d6d800ff0182702fa97bb93ec6 (commit)
- Log -----------------------------------------------------------------
commit b5b04647fe9281d6d800ff0182702fa97bb93ec6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Mar 24 17:10:56 2014 -0400
Return 503 on database connection error
Fixes issues #23332.
diff --git a/lib/RT/Interface/Web/Handler.pm b/lib/RT/Interface/Web/Handler.pm
index 078091f..f613a03 100644
--- a/lib/RT/Interface/Web/Handler.pm
+++ b/lib/RT/Interface/Web/Handler.pm
@@ -275,7 +275,14 @@ sub PSGIApp {
return $self->_psgi_response_cb( $res->finalize ) if $res;
}
- RT::ConnectToDatabase() unless RT->InstallMode;
+ unless (RT->InstallMode) {
+ unless (eval { RT::ConnectToDatabase() }) {
+ my $res = Plack::Response->new(503);
+ $res->content_type("text/plain");
+ $res->body("Database inaccessible; contact the RT administrator (".RT->Config->Get("OwnerEmail").")");
+ return $self->_psgi_response_cb( $res->finalize, sub { $self->CleanupRequest } );
+ }
+ }
my $req = Plack::Request->new($env);
-----------------------------------------------------------------------
More information about the rt-commit
mailing list