From: John Napiorkowski Date: Wed, 18 Feb 2009 19:35:19 +0000 (+0000) Subject: I guess ensure_connected does not have a return value... so I cannot use it. Fix... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8c2453bf9013095b167b5dea2bdd3a6ad9662c19;p=dbsrgits%2FDBIx-Class-Historic.git I guess ensure_connected does not have a return value... so I cannot use it. Fix for replication issue where replicants always get marked as unavailable even when there is no problem with them --- diff --git a/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm b/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm index 833ffad..76ca7f2 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm @@ -187,17 +187,19 @@ bringing down your entire pool of databases. sub _safely_ensure_connected { my ($self, $replicant, @args) = @_; - my $return; eval { - $return = $replicant->ensure_connected(@args); - }; if ($@) { + eval { + $replicant->ensure_connected(@args); + }; + if ($@) { $replicant - ->debugobj - ->print( - sprintf( "Exception trying to ->ensure_connected for replicant %s, error is %s", - $self->_dbi_connect_info->[0], $@) + ->debugobj + ->print( + sprintf( "Exception trying to ->ensure_connected for replicant %s, error is %s", + $replicant->_dbi_connect_info->[0], $@) ); + return; } - return $return; + return 1; } =head2 connected_replicants