Don't do anything if no events generated.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@899 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2004-02-26 11:10:57 +00:00
parent 1bfa6ed780
commit 0d9341f77b
1 changed files with 9 additions and 10 deletions

View File

@ -201,15 +201,6 @@ my $last_action = 0;
while( 1 ) while( 1 )
{ {
my $sql = "select max(Id) as LastEventId from Events";
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() );
my $row = $sth->fetchrow_hashref();
$last_event_id = $row->{LastEventId};
$sth->finish();
print( "Last event generated is $last_event_id\n" ) if ( VERBOSE );
if ( (time() - $last_action) > ZM_FILTER_RELOAD_DELAY ) if ( (time() - $last_action) > ZM_FILTER_RELOAD_DELAY )
{ {
print( "Reloading filters\n" ) if ( VERBOSE ); print( "Reloading filters\n" ) if ( VERBOSE );
@ -224,8 +215,16 @@ while( 1 )
CheckFilter( $filter ); CheckFilter( $filter );
} }
if ( $last_event_id > $event_id ) my $sql = "select max(Id) as LastEventId from Events";
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() );
my $row = $sth->fetchrow_hashref();
$last_event_id = $row->{LastEventId};
$sth->finish();
if ( $last_event_id && $last_event_id > $event_id )
{ {
print( "Last event generated is $last_event_id\n" ) if ( VERBOSE );
# Got new event to check # Got new event to check
foreach my $filter ( @id_filters ) foreach my $filter ( @id_filters )
{ {