mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-23 04:19:27 +01:00
lagchecker: use immediate elasped duration instead of average when no pong has been received yet
This commit is contained in:
parent
44bef4bdb3
commit
e10d81b769
@ -102,14 +102,7 @@ sub lagging {
|
|||||||
if(defined $self->{pong_received} and $self->{pong_received} == 0) {
|
if(defined $self->{pong_received} and $self->{pong_received} == 0) {
|
||||||
# a ping has been sent (pong_received is not undef) and no pong has been received yet
|
# a ping has been sent (pong_received is not undef) and no pong has been received yet
|
||||||
my $elapsed = tv_interval($self->{ping_send_time});
|
my $elapsed = tv_interval($self->{ping_send_time});
|
||||||
my $lag_total = $elapsed;
|
return $elapsed >= $self->{LAG_THRESHOLD};
|
||||||
my $len = @{ $self->{lag_history} };
|
|
||||||
foreach my $entry (@{ $self->{lag_history} }) {
|
|
||||||
my ($send_time, $lag_result) = @{ $entry };
|
|
||||||
$lag_total += $lag_result;
|
|
||||||
}
|
|
||||||
my $average = $lag_total / ($len + 1);
|
|
||||||
return $average >= $self->{LAG_THRESHOLD};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0 if not defined $self->{lag_average};
|
return 0 if not defined $self->{lag_average};
|
||||||
|
@ -13,7 +13,7 @@ use warnings;
|
|||||||
# These are set automatically by the build/commit script
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 329,
|
BUILD_REVISION => 330,
|
||||||
BUILD_DATE => "2011-12-11",
|
BUILD_DATE => "2011-12-11",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user