Committer: vad
LJSUP-9778: Restore sms-notifications statistics to e-mailU trunk/bin/misc/smsru_stats.pl
Modified: trunk/bin/misc/smsru_stats.pl =================================================================== --- trunk/bin/misc/smsru_stats.pl 2011-09-14 06:33:30 UTC (rev 11002) +++ trunk/bin/misc/smsru_stats.pl 2011-09-14 08:41:48 UTC (rev 11003) @@ -37,8 +37,9 @@ foreach my $cid (@LJ::CLUSTERS) { print "Querying cluster $cid...\n" if $verbose; - my $udb = LJ::DBUtil->connect_to_cluster($cid, $verbose) - or die "Unable to connect database for cluster: $cid\n"; + my $udb = eval { LJ::DBUtil->connect_to_cluster($cid, $verbose) }; + $udb ||= LJ::get_cluster_reader($cid); ## connect to master if the slave is unavailable + die "Unable to connect database for cluster: $cid\n" unless $udb; my $sth = $udb->prepare( "SELECT userid, to_number, msg, DATE_FORMAT(added, '\%Y-\%m-\%d') as added, msg_type " .