You've already forked explain.depesz.com
mirror of
https://gitlab.com/depesz/explain.depesz.com.git
synced 2025-07-03 00:58:12 +02:00
Implement /status to show if db is accessible
This commit is contained in:
@ -41,6 +41,9 @@ sub startup {
|
|||||||
# route: 'index'
|
# route: 'index'
|
||||||
$routes->route( '/' )->to( 'controller#index' )->name( 'new-explain' );
|
$routes->route( '/' )->to( 'controller#index' )->name( 'new-explain' );
|
||||||
|
|
||||||
|
# route: 'status'
|
||||||
|
$routes->route( '/status' )->to( 'controller#status' )->name( 'status' );
|
||||||
|
|
||||||
# route: 'new-optimization'
|
# route: 'new-optimization'
|
||||||
$routes->route( '/new_optimization' )->to( 'controller#new_optimization' )->name( 'new-optimization' );
|
$routes->route( '/new_optimization' )->to( 'controller#new_optimization' )->name( 'new-optimization' );
|
||||||
|
|
||||||
|
@ -412,6 +412,15 @@ sub info {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub status {
|
||||||
|
my $self = shift;
|
||||||
|
if ($self->database->ping()) {
|
||||||
|
$self->render('text' => 'OK', status => 200);
|
||||||
|
} else {
|
||||||
|
$self->render('text' => 'DB FAILED', status => 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sub help {
|
sub help {
|
||||||
|
|
||||||
# direct to template
|
# direct to template
|
||||||
|
@ -223,6 +223,11 @@ sub save_with_random_name {
|
|||||||
return @row;
|
return @row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub ping {
|
||||||
|
my $self = shift;
|
||||||
|
return $self->dbh->ping();
|
||||||
|
}
|
||||||
|
|
||||||
sub get_plan_data {
|
sub get_plan_data {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ( $plan_id ) = @_;
|
my ( $plan_id ) = @_;
|
||||||
|
Reference in New Issue
Block a user