You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by pa...@apache.org on 2004/11/17 02:03:27 UTC
svn commit: rev 76071 - spamassassin/branches/3.0/lib/Mail/SpamAssassin/BayesStore
Author: parker
Date: Tue Nov 16 17:03:26 2004
New Revision: 76071
Modified:
spamassassin/branches/3.0/lib/Mail/SpamAssassin/BayesStore/SQL.pm
Log:
Bug 3953: Provide better debug output for sa-learn --restore
Modified: spamassassin/branches/3.0/lib/Mail/SpamAssassin/BayesStore/SQL.pm
==============================================================================
--- spamassassin/branches/3.0/lib/Mail/SpamAssassin/BayesStore/SQL.pm (original)
+++ spamassassin/branches/3.0/lib/Mail/SpamAssassin/BayesStore/SQL.pm Tue Nov 16 17:03:26 2004
@@ -1413,6 +1413,9 @@
return 0;
}
+ my $token_error_count = 0;
+ my $seen_error_count = 0;
+
while (my $line = <DUMPFILE>) {
chomp($line);
$line_count++;
@@ -1481,7 +1484,7 @@
unless ($self->_put_token($token, $spam_count, $ham_count, $atime)) {
dbg("bayes: Error inserting token for line: $line");
- $error_p = 1;
+ $token_error_count++;
}
$token_count++;
}
@@ -1502,12 +1505,24 @@
unless ($self->seen_put($msgid, $flag)) {
dbg("bayes: Error inserting msgid in seen table for line: $line");
- $error_p = 1;
+ $seen_error_count++;
}
}
else {
dbg("bayes: Skipping unknown line: $line");
next;
+ }
+
+ if ($token_error_count >= 20) {
+ warn "Encountered too many errors (20) while parsing token line, reverting to empty database and exiting.\n";
+ $self->clear_database();
+ return 0;
+ }
+
+ if ($seen_error_count >= 20) {
+ warn "Encountered too many errors (20) while parsing seen lines, reverting to empty database and exiting.\n";
+ $self->clear_database();
+ return 0;
}
}
close(DUMPFILE);