Skip to content
Snippets Groups Projects
Commit e5d291dc authored by Ian Longden's avatar Ian Longden
Browse files

fix for errors in getting a database connection when in...

fix for errors in getting a database connection when in disconnect_when_inactive set and is being called to0 fast for the system to keep up with
parent 853ff6d3
No related merge requests found
......@@ -225,6 +225,7 @@ sub new {
sub connect {
my ($self) = @_;
if ( $self->connected() ) { return }
$self->connected(1);
......@@ -304,10 +305,18 @@ sub connect {
$self->driver(), $self->dbname(),
$self->host(), $self->port() );
if( $self->{'disconnect_when_inactive'}){
$self->{'count'}++;
if($self->{'count'} > 1000){
sleep 1;
print "sleep\n";
$self->{'count'} = 0;
}
}
eval {
$dbh =
DBI->connect( $dsn, $self->username(), $self->password(),
{ 'RaiseError' => 1 } );
DBI->connect( $dsn, $self->username(), $self->password(),
{ 'RaiseError' => 1 } );
};
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment