]> git.donarmstrong.com Git - infobot.git/commitdiff
Chanserv 2nd stage fail protection
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Mon, 18 Sep 2000 11:46:25 +0000 (11:46 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Mon, 18 Sep 2000 11:46:25 +0000 (11:46 +0000)
Added seen stats.

git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@115 c11ca15a-4712-0410-83d8-924469b57eb5

src/IRC/Schedulers.pl

index ec13ea0ea8dc78c4f2264bd965ad4c0b3e2dac0c..e8b54bf0cecacfb00b81688da7ee1ff7cee59248 100644 (file)
@@ -1,7 +1,7 @@
 #
 # ProcessExtra.pl: Extensions to Process.pl
 #          Author: dms
-#         Version: v0.3 (20000707)
+#         Version: v0.4 (20000918)
 #         Created: 20000117
 #
 
@@ -288,6 +288,10 @@ sub floodCycle {
 sub seenFlush {
     my $nick;
     my $flushed = 0;
+    my %stats;
+    $stats{'count_old'} = &countKeys("seen");
+    $stats{'new'}      = 0;
+    $stats{'old'}      = 0;
 
     if ($param{'DBType'} =~ /^mysql|pg|postgres/i) {
        foreach $nick (keys %seencache) {
@@ -300,6 +304,7 @@ sub seenFlush {
                        "channel" => $seencache{$nick}{'chan'},
                        "message" => $seencache{$nick}{'msg'},
                ) );
+               $stats{'old'}++;
            } else {
                my $retval = &dbInsert("seen", $nick, (
                        "nick" => $seencache{$nick}{'nick'},
@@ -308,6 +313,7 @@ sub seenFlush {
                        "channel" => $seencache{$nick}{'chan'},
                        "message" => $seencache{$nick}{'msg'},
                ) );
+               $stats{'new'}++;
 
                ### TODO: put bad nick into a list and don't do it again!
                if ($retval == 0) {
@@ -342,6 +348,13 @@ sub seenFlush {
        &DEBUG("seenFlush: NO VALID FACTOID SUPPORT?");
     }
 
+    &DEBUG(sprintf("new seen: %03.01f%% (%d/%d)",
+                       $stats{'new'}*100/$stats{'count_old'}),
+                       $stats{'new'}, $stats{'count_old'} );
+    &DEBUG(sprintf("now seen: %3.1f%% (%d/%d)",
+                       $stats{'old'}*100/&countKeys("seen")),
+                       $stats{'old'}, &countKeys("seen") );
+
     &VERB("Flushed $flushed seen entries.",1); # was 2.
     &DEBUG("seen: ".scalar(keys %seenflush)." remaining.");
 
@@ -410,10 +423,9 @@ sub ircCheck {
        &WARN("ircCheck: ident($ident) != param{ircNick}($param{IrcNick}).");
     }
 
-    if (scalar @joinchan) {
-       &WARN("We have some channels to join, doing so.");
-       &joinNextChan();
-    }
+    &joinNextChan();
+       # if scalar @joinnext => join more channels
+       # else check for chanserv.
 
     if (grep /^\s*$/, keys %channels) {
        &WARN("we have a NULL chan in hash channels? removing!");