You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2006/03/22 06:39:25 UTC

[Bug 3109] RFE: really simple "this is ham" shortcircuiting

http://issues.apache.org/SpamAssassin/show_bug.cgi?id=3109





------- Additional Comments From dallase@nmgi.com  2006-03-22 05:39 -------
i am posting a short-circuit patch due to several personal requests.  i would 
say this is an over-simplified approach, but it does work very well... and it 
was created with very few lines of additional code in PerMsgStatus (37 to be 
exact).  it applies cleanly to current SVN, i have not tried it against 3.1.1 
or anything else.. feel free to do so.  

so basically, this code is just here for now in case you want to save some CPU 
cycles until there is something "better, faster, stronger" (ie pluganized check
() methods with improved priorities on evals, metas, plugins, etc).  below is 
just some basic info showing debug of it running.

-------------------------

normal message that didnt shortcircuit runs through all priorities you have 
defined.

[2203] dbg: check: running tests for priority: -100
[2203] dbg: check: running tests for priority: 0
[2203] dbg: check: running tests for priority: 500
[2203] dbg: check: running tests for priority: 1000

and now a shortcircuited rule (set priority -100 so it runs first)

body TEST /test/i
describe TEST this is just a test rule to show how shortcircuiting works..
score TEST 1.0
priority TEST -100
shortcircuit TEST ham

[2203] dbg: check: running tests for priority: -100
[2203] dbg: shortcircuit: hit on rule TEST, sc type is ham, apply score of -5

As you can see, priority 0, 500, and 100 were skiped. Changing shortcircuit 
method to 'spam' gives

[2216] dbg: check: running tests for priority: -100
[2216] dbg: shortcircuit: hit on rule TEST, sc type is spam, apply score of 15

# echo -e "\n\ntest" | spamc
X-Spam-Tests: TEST
X-Spam-Score: 15.0
X-Spam-Flag: YES

the values -5 and 15 are applied by setting a couple options in local.cf

shortcircuit_spam_score		15
shortcircuit_ham_score		-5

If you do not set these items to your choice, they default to 100 (spam) and -
100 (ham). 

Thats pretty much it.  It works great for hitting body, rawbody and headers 
rules that you know have a 1.0 S/O (spam-o-the-day).   be careful out there!

-------------------------

thx. dallas







------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.