You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2021/04/20 05:28:49 UTC

svn commit: r1888996 - /spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi

Author: hege
Date: Tue Apr 20 05:28:49 2021
New Revision: 1888996

URL: http://svn.apache.org/viewvc?rev=1888996&view=rev
Log:
Limit show_mclog to 100 matches to limit resource usage

Modified:
    spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi

Modified: spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi
URL: http://svn.apache.org/viewvc/spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi?rev=1888996&r1=1888995&r2=1888996&view=diff
==============================================================================
--- spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi (original)
+++ spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi Tue Apr 20 05:28:49 2021
@@ -820,7 +820,8 @@ sub show_mclog {
     die "cannot open $gzfile";
   }
 
-  open (GZ, "pigz -cd < $gzfile |") or die "cannot gunzip '$gzfile'";
+  my $lines = 0;
+  open (GZ, "pigz -cd < $gzfile | grep -F '$saferule' |") or die "cannot gunzip '$gzfile'";
   while (<GZ>) {
     /^[\.Y]\s+\S+\s+\S+\s+(?:\S*,|)\Q$saferule\E[, ]/ or next;
 
@@ -828,6 +829,7 @@ sub show_mclog {
     s/,mid=<.*>,/,mid=<REMOVED_BY_RULEQA>,/gs;
 
     print;
+    last if ++$lines >= 100;
   }
 
   close GZ;