X-Git-Url: https://git.sesse.net/?p=remoteglot;a=blobdiff_plain;f=remoteglot.pl;h=8cfb0be553049e74ba03fef87597a76bc02838b7;hp=b128e29735b99e7a520d1d31ecec61db0d7cfe40;hb=9ce0e4167a9365bf67c2df74203a092e6be4263c;hpb=96875773d3cd75a57b13cba9d1497c616cf76503 diff --git a/remoteglot.pl b/remoteglot.pl index b128e29..8cfb0be 100755 --- a/remoteglot.pl +++ b/remoteglot.pl @@ -28,8 +28,8 @@ use warnings; no warnings qw(once); # Program starts here -$SIG{ALRM} = sub { output(); }; my $latest_update = undef; +my $output_timer = undef; my $http_timer = undef; my $tb_retry_timer = undef; my %tb_cache = (); @@ -478,7 +478,8 @@ sub output { # Don't update too often. my $age = Time::HiRes::tv_interval($latest_update); if ($age < $remoteglotconf::update_max_interval) { - Time::HiRes::alarm($remoteglotconf::update_max_interval + 0.01 - $age); + my $wait = $remoteglotconf::update_max_interval + 0.01 - $age; + $output_timer = AnyEvent->timer(after => $wait, cb => \&output); return; }