From 69316aa9d2bfb5c3954ece600c2b763a5e36b540 Mon Sep 17 00:00:00 2001 From: dms Date: Sun, 22 Apr 2001 14:58:05 +0000 Subject: [PATCH] fix on_targettoofast once and for all, hopefully. git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@462 c11ca15a-4712-0410-83d8-924469b57eb5 --- src/IRC/IrcHooks.pl | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/IRC/IrcHooks.pl b/src/IRC/IrcHooks.pl index 22df4e6..7c6ea78 100644 --- a/src/IRC/IrcHooks.pl +++ b/src/IRC/IrcHooks.pl @@ -851,9 +851,22 @@ sub on_targettoofast { ### TODO: incomplete. if ($why =~ /.* wait (\d+) second/) { - my $sleep = $1; - &status("targettoofast: going to sleep for $sleep..."); - sleep $sleep; + my $sleep = $1; + my $max = 10; + + if ($sleep > $max) { + &status("targettoofast: going to sleep for $max ($sleep)..."); + $sleep = $max; + } else { + &status("targettoofast: going to sleep for $sleep"); + } + + my $delta = time() - ($cache{sleepTime} || 0); + if ($delta > $max+2) { + sleep $sleep; + $cache{sleepTime} = time(); + } + } else { if (!exists $cache{TargetTooFast}) { &DEBUG("on_ttf: failed: $why"); -- 2.39.5