Unverified Commit 1eac3f52 authored by Gavin Brown's avatar Gavin Brown
Browse files

call update_stats() before sleeping

parent aeb02e14
......@@ -169,12 +169,16 @@ sub main_loop {
my $t0 = time();
#
# spawn threads
#
my %threads;
foreach my $ns (sort(@SERVERS)) {
#
# resolve nameserver to IP addresses in the main thread
#
my @ips = resolve($ns, $CONF->{'AddressFamily'});
#
# spawn thread
#
$threads{$ns} = threads->create(\&time_query, ($CONF->{'AddressFamily'}, $CONF->{'Protocol'}, , @ips));
}
......@@ -193,17 +197,17 @@ sub main_loop {
}
}
#
# update stats
#
update_stats() if (time() - $UPDATED >= $CONF->{'UpdateInterval'});
my $dt = (time() - $t0);
#
# sleep if we need to
#
sleep($CONF->{'Loop'}-$dt) if ($dt < $CONF->{'Loop'});
#
# update stats
#
update_stats() if (time() - $UPDATED >= $CONF->{'UpdateInterval'});
};
if ($@) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment