add db reconnects to zmwatch.
This commit is contained in:
parent
af32d59aa1
commit
426aeea95b
|
@ -78,6 +78,11 @@ my $sth = $dbh->prepare_cached($sql)
|
|||
or Fatal("Can't prepare '$sql': ".$dbh->errstr());
|
||||
|
||||
while( 1 ) {
|
||||
while ( ! ( $dbh and $dbh->ping() ) ) {
|
||||
if ( ! ( $dbh = zmDbConnect() ) ) {
|
||||
sleep($Config{ZM_WATCH_CHECK_INTERVAL});
|
||||
}
|
||||
}
|
||||
|
||||
my $res = $sth->execute( $Config{ZM_SERVER_ID} ? $Config{ZM_SERVER_ID} : () )
|
||||
or Fatal('Can\'t execute: '.$sth->errstr());
|
||||
|
@ -98,7 +103,7 @@ while( 1 ) {
|
|||
Debug("Monitor $$monitor{Id} LastWriteTime is $capture_time.");
|
||||
if ( !$capture_time ) {
|
||||
my $startup_time = zmGetStartupTime($monitor);
|
||||
if ( $now - $startup_time > $Config{ZM_WATCH_MAX_DELAY} ) {
|
||||
if ( ( $now - $startup_time ) > $Config{ZM_WATCH_MAX_DELAY} ) {
|
||||
Info(
|
||||
"Restarting capture daemon for $$monitor{Name}, no image since startup. ".
|
||||
"Startup time was $startup_time - now $now > $Config{ZM_WATCH_MAX_DELAY}"
|
||||
|
@ -111,7 +116,8 @@ while( 1 ) {
|
|||
}
|
||||
}
|
||||
if ( ! $restart ) {
|
||||
my $max_image_delay = ( $monitor->{MaxFPS}
|
||||
my $max_image_delay = (
|
||||
$monitor->{MaxFPS}
|
||||
&&($monitor->{MaxFPS}>0)
|
||||
&&($monitor->{MaxFPS}<1)
|
||||
) ? (3/$monitor->{MaxFPS})
|
||||
|
|
Loading…
Reference in New Issue