Sleep 10 secs if db connection fails to reduce log spamming and load

This commit is contained in:
Isaac Connor 2020-06-30 18:59:27 -04:00
parent aff7e27dee
commit c022cae7ef
1 changed files with 2 additions and 1 deletions

View File

@ -301,13 +301,14 @@ sub run {
my $timeout = 1;
my $secs_count = 0;
while( !$zm_terminate ) {
while ( !$zm_terminate ) {
if ( $Config{ZM_SERVER_ID} ) {
if ( ! ( $secs_count % 60 ) ) {
while ( (!$zm_terminate) and !($dbh and $dbh->ping()) ) {
Warning("Not connected to db ($dbh)".($dbh?' ping('.$dbh->ping().')':''). ($DBI::errstr?" errstr($DBI::errstr)":'').' Reconnecting');
$dbh = zmDbConnect();
sleep 10 if !$dbh;
}
last if $zm_terminate;