From 7aa9f0aeabfb5966a98083242aca00eefe30abca Mon Sep 17 00:00:00 2001 From: "Andreas J. Koenig" Date: Wed, 9 Feb 2011 22:47:44 +0100 Subject: [PATCH] shorten handle_event by the potential aggregate call and move it after the call to batch_update --- bin/rrr-server | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/rrr-server b/bin/rrr-server index 4b153af..4d52591 100755 --- a/bin/rrr-server +++ b/bin/rrr-server @@ -133,10 +133,7 @@ sub newdir { } } -my $last_aggregate_call = 0; my $requires_fsck = 1; -my $have_warned_fsck = 0; - sub handle_event { my($ev,$batch) = @_; my @stringifiedmask; @@ -193,11 +190,10 @@ sub handle_event { warn "[$time] Ignore $reportname (@stringifiedmask)\n"; } } - if (time > $last_aggregate_call + $rf->interval_secs) { - $rf->aggregate; - $last_aggregate_call = time; - } -}; +} + +my $last_aggregate_call = 0; +my $have_warned_fsck = 0; while () { my @events = $inotify->read; @@ -210,6 +206,10 @@ while () { handle_event($event,\@batch); } $rf->batch_update(\@batch); + if (time > $last_aggregate_call + 30) { + $rf->aggregate; + $last_aggregate_call = time; + } if ($requires_fsck) { if (time > $have_warned_fsck + 3600) { warn "REMINDER: TODO: HANDLE FSCK"; -- 2.11.4.GIT