You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2006/12/25 08:47:59 UTC

svn commit: r490114 - /spamassassin/trunk/spamd/spamd.raw

Author: felicity
Date: Sun Dec 24 23:47:58 2006
New Revision: 490114

URL: http://svn.apache.org/viewvc?view=rev&rev=490114
Log:
bug 3466: do the bayes expiry after results have been passed back to the client from spamd, helps avoid client timeouts, etc.

Modified:
    spamassassin/trunk/spamd/spamd.raw

Modified: spamassassin/trunk/spamd/spamd.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/spamd/spamd.raw?view=diff&rev=490114&r1=490113&r2=490114
==============================================================================
--- spamassassin/trunk/spamd/spamd.raw (original)
+++ spamassassin/trunk/spamd/spamd.raw Sun Dec 24 23:47:58 2006
@@ -844,6 +844,10 @@
   }
 );
 
+$spamtest->init_learner({
+  opportunistic_expire_check_only => 1,
+});
+
 # if $clients_per_child == 1, there's no point in copying configs around
 unless ($clients_per_child > 1) {
   # unset $copy_config_p so we don't bother trying to copy things back
@@ -1409,7 +1413,9 @@
   }
 
   # Go ahead and check the message
-  my $status = $spamtest->check($mail);
+  $spamtest->init(1);
+  my $status = Mail::SpamAssassin::PerMsgStatus->new($spamtest, $mail);
+  $status->check();
 
   my $msg_score     = sprintf( "%.1f", $status->get_score );
   my $msg_threshold = sprintf( "%.1f", $status->get_required_score );
@@ -1527,6 +1533,16 @@
 
   # bug 3808: log scan results to any listening plugins, too
   $spamtest->call_plugins("log_scan_result", { result => $log });
+
+  # bug 3466: handle the bayes expiry bits after the results were returned to
+  # the client.  keeps clients from timing out.  if bayes_expiry_due is set,
+  # then the opportunistic check has already checked.  go ahead and do another
+  # sync/expire run.
+  if ($status->{'bayes_expiry_due'}) {
+    dbg("spamd: bayes expiry was marked as due, running post-check");
+    $spamtest->rebuild_learner_caches();
+    $spamtest->finish_learner();
+  }
 
   $status->finish();    # added by jm to allow GC'ing
   $mail->finish();