projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
stop the Timer::handler searching its chain more than once a second
[spider.git]
/
perl
/
Timer.pm
diff --git
a/perl/Timer.pm
b/perl/Timer.pm
index 4a1e1c42e165395145eb913d124bdab2007991b9..fc1103159d2150cd3a9468669abfc3f226fc568c 100644
(file)
--- a/
perl/Timer.pm
+++ b/
perl/Timer.pm
@@
-22,6
+22,8
@@
$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0))
$main::build += $VERSION;
$main::branch += $BRANCH;
$main::build += $VERSION;
$main::branch += $BRANCH;
+my $lasttime = 0;
+
sub new
{
my ($pkg, $time, $proc, $recur) = @_;
sub new
{
my ($pkg, $time, $proc, $recur) = @_;
@@
-45,7
+47,9
@@
sub del
sub handler
{
my $now = time;
sub handler
{
my $now = time;
-
+
+ return unless $now != $lasttime;
+
# handle things on the timer chain
my $t;
foreach $t (@timerchain) {
# handle things on the timer chain
my $t;
foreach $t (@timerchain) {
@@
-54,6
+58,8
@@
sub handler
$t->{t} = $now + $t->{interval} if exists $t->{interval};
}
}
$t->{t} = $now + $t->{interval} if exists $t->{interval};
}
}
+
+ $lasttime = $now;
}
sub DESTROY
}
sub DESTROY