&freshmeatLoop(2);
&kernelLoop(2);
&wingateWriteFile(2);
- &factoidCheck(2);
+ &factoidCheck(1);
&newsFlush(1);
# my $count = map { exists $sched{$_}{TIME} } keys %sched;
my $i = 0;
my $total = scalar(keys %{ $::news{$chan} });
- &DEBUG("newsFlush: chan => $chan");
+ &DEBUG("newsFlush: chan => $chan (total => $total)");
foreach $item (keys %{ $::news{$chan} }) {
my $t = $::news{$chan}{$item}{Expire};
delete $::newsuser{$chan}{$_};
$duser++;
}
+
+ my $i = scalar(keys %{ $::newsuser{$chan} });
+ delete $::newsuser{$chan} unless ($i);
}
if ($delete or $duser) {
- &DEBUG("newsF: Writing news.");
&News::writeNews();
- &status("NEWS (newsflush) deleted: $delete news entries; $duser user cache.");
+ &status("NewsFlush: deleted: $delete news entries; $duser user cache.");
}
}
return if ($_[0] eq "2");
}
+ $cache{chanlimitCheck}++;
+ &DEBUG("clC: chanlimitCheck => $cache{chanlimitCheck}");
+
foreach $chan ( &ChanConfList("chanlimitcheck") ) {
next unless (&validChan($chan));
return if ($_[0] eq "2");
}
- &DEBUG("running netsplitCheck...");
+ $cache{'netsplitCache'}++;
+ &DEBUG("running netsplitCheck... $cache{netsplitCache}");
+
+ if (!scalar %netsplit and scalar %netsplitservers) {
+ &DEBUG("nsc: FIRST!!! ok hash netsplit is NULL; purging hash netsplitservers");
+ undef %netsplitservers;
+ }
foreach $s1 (keys %netsplitservers) {
- &DEBUG("nsC: s1 => $s1");
foreach $s2 (keys %{ $netsplitservers{$s1} }) {
my $delta = time() - $netsplitservers{$s1}{$s2};
- &DEBUG("nss{$s1}{$s2} = $delta");
- if (time() - $netsplitservers{$s1}{$s2} > 3600) {
+ if ($delta > 3600) {
&status("netsplit between $s1 and $s2 appears to be stale.");
delete $netsplitservers{$s1}{$s2};
+ &chanlimitCheck();
}
}
+
+ my $i = scalar(keys %{ $netsplitservers{$s1} });
+ delete $netsplitservers{$s1} unless ($i);
}
# %netsplit hash checker.
my $count = scalar keys %netsplit;
+ my(@delete);
foreach (keys %netsplit) {
if (&IsNickInAnyChan($_)) {
&DEBUG("netsplitC: $_ is in some chan; removing from netsplit list.");
delete $netsplit{$_};
next;
}
- next unless (time() - $netsplit{$_} > 60*10);
+ # todo: change time value?
+ next unless (time() - $netsplit{$_} > 60*30);
- &DEBUG("netsplitC: $_ didn't come back from netsplit; removing from netsplit list.");
+ push(@delete, $_);
delete $netsplit{$_};
}
+ &DEBUG("removed from netsplit list (".scalar(@delete)."): @delete") if (@delete);
&DEBUG("nsC: netsplitservers: ".scalar(keys %netsplitservers) );
&DEBUG("nsC: netsplit: ".scalar(keys %netsplit) );
+ if (!scalar %netsplit and scalar %netsplitservers) {
+ &DEBUG("nsc: ok hash netsplit is NULL; purging hash netsplitservers");
+ undef %netsplitservers;
+ }
+
if ($count and !scalar keys %netsplit) {
&DEBUG("nsC: netsplit is hopefully gone. reinstating chanlimit check.");
&chanlimitCheck();
&DEBUG("seenFlush: NO VALID FACTOID SUPPORT?");
}
- &status("Flushed $flushed seen entries.") if ($flushed);
+ &status("Seen: Flushed $flushed entries.") if ($flushed);
&VERB(sprintf(" new seen: %03.01f%% (%d/%d)",
$stats{'new'}*100/($stats{'count_old'} || 1),
$stats{'new'}, ( $stats{'count_old'} || 1) ), 2) if ($stats{'new'});
sub factoidCheck {
if (@_) {
- &ScheduleThis(1440, "factoidCheck");
+ &ScheduleThis(720, "factoidCheck");
return if ($_[0] eq "2"); # defer.
}
foreach (@list) {
my $age = &getFactInfo($_, "modified_time");
+ &DEBUG("fC: _ => '$_'; age => $age");
if (!defined $age or $age !~ /^\d+$/) {
if (scalar @list > 50) {
}
}
- &WARN("old cruft (no time): $_");
+ &WARN("del factoid: old cruft (no time): $_");
&delFactoid($_);
next;
}
+ &DEBUG("del factoid: delta => ".($time - $age) );
+ &DEBUG("del factoid: stale => $stale");
next unless ($time - $age > $stale);
my $fix = $_;
$fix =~ s/ #DEL#$//g;
- &DEBUG("safedel: Removing $fix ($_) for good.");
+ my $agestr = &Time2String($time - $age);
+ &DEBUG("safedel: Removing '$_' for good. [$agestr old]");
&delFactoid($_);
}