Hi,

I have an issue with a Mojolicious app that seems to loose connection to a 
Postgres database whenever the postgres service is restarted. Is this 
normal behavior, shouldn't the Mojo app automatically reconnect without 
having to restart hypnotoad?

The error that gets logged is:
[error] no connection to the server at /var/www/mojoApp...

Postgres db connection:

app->attr(db => sub {
    my $self = shift;
    my $dbh = &connect('dbname');
    return $dbh;
});

connect sub:

        my ($dbname) = shift;

        if($dbname && $dbname ne '')
        {
                my $host='xx.xx.xx.xx';
                my $dsn=qq(dbi:Pg:dbname=$dbname;host=$host);
                my $dbusername = xx;
                my $password = xx;
                my $dbh = DBI->connect($dsn,$dbusername,$password)|| 
die("Connect error: $DBI::errstr");
                return $dbh;
        }

Is there something else that I need to add?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/742b60f5-af10-44db-b303-e1631272ca15%40googlegroups.com.

Reply via email to